<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::fallback(function(){
    return response()->json(['message' => 'Not Found'], 404);
});

    Route::post('login/login', 'LoginController@login');
    Route::group(['middleware'=>'check_token','admin_request_info'],function ($api) {
        $api->group(['prefix' => 'login'], function ($api) {
            $api->post('logout', 'LoginController@logout');
            $api->get('user', 'LoginController@user');
        });

        $api->group(['prefix' => 'index'], function ($api) {
            $api->get('index', 'IndexController@index');
            $api->get('get_agent_pay_rate', 'IndexController@getAgentPayRate');
            $api->get('get_sale_order_by_all', 'IndexController@getSaleOrderByAll');
            $api->get('export_sale_order_by_all', 'IndexController@exportSaleOrderByAll');
            $api->get('yesterday_order_by', 'IndexController@yesterdayOrderBy');
            $api->get('all_order_by', 'IndexController@allOrderBy');
            $api->get('get_sale_info', 'IndexController@getSaleinfo');
            $api->get('get_history_total', 'IndexController@getHistoryTotal');
            $api->get('get_sku_history_num', 'IndexController@getSkuHistoryNum');
            $api->get('get_sku_order_by', 'IndexController@getSkuOrderBy');
            $api->get('get3_days_sales0', 'IndexController@get3DaysSales0');
            $api->get('export3_days_sales0', 'IndexController@export3DaysSales0');
            $api->get('get_every_add_agent', 'IndexController@getEveryAddAgent');
            $api->get('get_every_add_agent_sort', 'IndexController@getEveryAddAgentSort');
            $api->get('get_every_add_agent_line', 'IndexController@getEveryAddAgentLine');
        });

        $api->group(['prefix' => 'admin'], function ($api) {
            $api->get('index', 'AdminController@index');
            $api->post('add', 'AdminController@add');
            $api->post('edit', 'AdminController@edit');
            $api->post('destroy', 'AdminController@destroy');
            $api->post('disabled', 'AdminController@disabled');
            $api->post('upload_role', 'AdminController@uploadRole');
            $api->post('update_role', 'AdminController@updateRole');
            $api->get('get_all_roles', 'AdminController@getAllRoles');
        });

        $api->group(['prefix' => 'test_user'], function ($api) {
            $api->get('index', 'TestUserController@index');
        });

        $api->group(['prefix' => 'role'], function ($api) {
            $api->get('index', 'RoleController@index');
            $api->post('add', 'RoleController@add');
            $api->post('edit', 'RoleController@edit');
            $api->post('destroy', 'RoleController@destroy');
        });

        $api->group(['prefix' => 'user'], function ($api) {
            $api->get('list', 'UserController@list');
            $api->get('export', 'UserController@export');
            $api->post('disabled', 'UserController@disabled');
            $api->post('editUserInfo', 'UserController@editUserInfo');
        });

        $api->group(['prefix' => 'setting'], function ($api) {
            $api->get('getUploadQiNiuToken', 'SettingController@getUploadQiNiuToken');
            $api->get('get_video_all', 'SettingController@getVideoAll');
            $api->get('get_video_2id', 'SettingController@getVideo2Id');
            $api->post('add_video', 'SettingController@addVideo');
            $api->post('edit_video', 'SettingController@editVideo');
            $api->post('delete_video', 'SettingController@deleteVideo');
        });

        $api->group(['prefix' => 'order'], function ($api) {
            $api->get('list', 'OrderController@list');
            $api->get('get_order_details', 'OrderController@getOrderDetails');
            $api->get('export', 'OrderController@export');
            $api->get('get_order_express', 'OrderController@getOrderExpress');
            $api->get('get_abnormal_order', 'OrderController@getAbnormalOrder');
            $api->get('get_order_daily_sales', 'OrderController@getOrderDailySales');
            $api->get('get_store_top10', 'OrderController@getStoreTop10');
        });

        $api->group(['prefix' => 'refund'], function ($api) {
            $api->get('get_refund_order', 'RefundController@getRefundOrder');
            $api->get('get_refund_order_detail', 'RefundController@getRefundOrderDetail');
            $api->post('agree_refund', 'RefundController@agreeRefund');
        });

        $api->group(['prefix' => 'store'], function ($api) {
            $api->get('list', 'StoreController@list');
            $api->get('get_data_info', 'StoreController@getDataInfo');
            $api->get('export', 'StoreController@export');
            $api->get('get_all_user', 'StoreController@getAllUser');
            $api->post('disabled', 'StoreController@disabled');
            $api->get('query', 'StoreController@query');
            $api->get('get_account_info', 'StoreController@getAccountInfo');
            $api->get('get_account_detail', 'StoreController@getAccountDetail');
            $api->get('get_account_detail_all', 'StoreController@getAccountDetailAll');
            $api->post('deleteStore', 'StoreController@deleteStore');
            $api->post('resDelStore', 'StoreController@resDelStore');
            $api->post('newStore', 'StoreController@newStore');
        });

        $api->group(['prefix' => 'goods'], function ($api) {
            $api->get('list', 'GoodsController@list');
            $api->post('add_goods', 'GoodsController@addGoods');
            $api->post('edit_goods', 'GoodsController@editGoods');
            $api->post('edit_size_desc', 'GoodsController@editSizeDesc');
            $api->post('shelves', 'GoodsController@shelves');
            $api->post('upload_img', 'GoodsController@uploadImg');
            $api->post('destroy', 'GoodsController@destroy');
            $api->get('get_goods_sku_sales_value', 'GoodsController@getGoodsSkuSalesValue');
        });

        $api->group(['prefix' => 'comment'], function ($api) {
            $api->get('list', 'CommentController@list');
            $api->get('detail', 'CommentController@detail');
            $api->post('destroy', 'CommentController@destroy');
        });

        $api->group(['prefix' => 'product'], function ($api) {
            $api->get('/getProductInfo', 'ProductController@getProductInfo');
            $api->post('/uploadImg', 'ProductController@uploadImg');
            $api->post('/uploadVideo', 'ProductController@uploadVideo');
            $api->post('/saveProductInfo', 'ProductController@saveProductInfo');
        });
    });

