<?php
/**
 * 图书路由文件
 * by zhanyang
 *
 * 2017-12-05
 */


Route::group(['domain'=>env('PAY_WAP_DOMAIN'),'namespace'=>'App\Http\Controllers\Wap'],function(){
    //支付
    Route::get('/goToPay','Pay\OrdersController@wxindex');
    //支付会掉
    Route::any('pay/wcback_allinpay','Pay\OrdersController@wcback_allinpay');
    Route::any('pay/wcback_official','Pay\OrdersController@wcback_official');
    Route::any('pay/wcback_lianlianpay','Pay\OrdersController@wcback_lianlianpay');
    Route::any('pay/wcback_palmpay','Pay\OrdersController@wcback_palmpay');
    Route::post('pay/reportError','Pay\OrdersController@reportError');
});
Route::group(['domain'=>env('OFFICIAL_AUTH_FOMAIN'),'namespace'=>'App\Http\Controllers\Wap'],function(){
    Route::any('/user_oauth','Oauth\UsersController@user_oauth');
    Route::get('/wxAuthCallBack','Oauth\UsersController@wcCallbackParse');

    Route::any('/user_oauth_v2','Oauth\UsersV2Controller@user_oauth');
    Route::get('/wxAuthCallBackv2','Oauth\UsersV2Controller@wcCallbackParse');
    Route::get('/wxAuthCallBack2v2','Oauth\UsersV2Controller@wcCallbackParse2');
});

Route::group(['domain'=>env('HELP_DOMAIN'),'namespace'=>'App\Http\Controllers\Wap\Help'],function(){
    Route::get('/','HelpController@index');
    Route::get('/{id}','HelpController@helpDetail');
    Route::get('/help/getLinkByAppid','HelpController@getLinkByAppid');
});
//分享中间页
Route::group(['domain'=>env('share_domain'),'namespace'=>'App\Http\Controllers\Wap'],function(){
    Route::get('share/show','Advertises\ShareController@share');
    Route::any('share/jump','Advertises\ShareController@jump');
});



Route::group(['domain'=>env('WAP_DOMAIN'),'namespace'=>'App\Http\Controllers\Wap','middleware'=>'EnableCross'],function(){

    Route::any('help','Web\RedirectController@help');


    Route::any('testLogin','Web\RedirectController@testLogin');

    Route::get('pay/wait','Pay\OrdersController@waitPage');
    Route::get('pay/waitv2','Pay\OrdersController@waitPageV2');

    //链接强关跳转地址
    Route::get('subscribeauth','Subscribe\LinkSubscribeController@index');
    //枪关链接回调地址
    Route::get('subauthback','Subscribe\LinkSubscribeController@wxAuthCallBack');
    //用户行为
    Route::any('api/userBehavior','User\UserbehaviorController@collectionBehavior');
    Route::any('subscribe/qrcode','Subscribe\LinkSubscribeController@subscribeView');

    Route::get('advertise/show','Advertises\AdvertiseController@jump');
    Route::get('advertise/jump','Advertises\AdvertiseController@jumpToSource');
    Route::any('advertise/recieveUserBehavior','Advertises\AdvertiseController@recieveUserBehavior');
    Route::get('share/show','Advertises\ShareController@share');
    Route::any('share/jump','Advertises\ShareController@jump');

//web 接口
    Route::group(['prefix'=>'api'],function () {

        //图书详情
        Route::get('book/{bid}','Book\BookController@index');
        Route::get('bookFromWhere/{bid}','Book\BookController@index');
        //首页
        Route::get('books/{sex}/index','Book\BookController@getBookLists');
        //书库
        Route::get('books/library','Book\BookController@library');
        //相似推荐
        Route::get('books/similar','Book\BookController@similarRecom');
        //阅读完后的推荐
        Route::get('books/readOverRecommend','Book\BookController@readOverRecommend');
        //h5书籍智能推荐
        Route::get('books/H5SmartRecommendBooks','Book\BookController@H5SmartRecommendBooks');
        //排行榜
        Route::get('books/rank','Book\BookController@rank');
        //分类列表
        Route::get('books/getCategory','Book\BookCategoryController@getCategory');
        //目录不分页
        Route::get('books/{bid}/allcatalog','Book\ChapterController@getCatalog');

        //Route::get('books/{bid}/allcatalog/{aa}',function ($tt,$bid,$aa){return $bid.'---'.$aa;});
        //目录分页
        Route::get('books/{bid}/catalog','Book\ChapterController@getCatalogPerPage');
        //章节详情
        Route::get('books/{bid}/chapters/{cid}','Book\ChapterController@index')->where('cid','\d+');
        //余额订购
        Route::get('books/{bid}/balance/chapterOrders/{cid}','Book\ChapterController@pay');

        //Route::get('books/search','Book\BookController@bookSearch');

        //充值列表
        Route::get('order/chargeList','Order\OrdersController@chargeList');
        //章节订购列表
        Route::get('order/chapterOrderList','Order\OrdersController@chapterOrderList');
        //单本订购列表
        Route::get('order/bookOrderList','Order\OrdersController@bookOrderList');
        //充值记录
        Route::get('order/chargeRecordLists','Order\OrdersController@chargeRecordLists');

        Route::get('order/issuccess','Order\OrdersController@isSuccess');

        //代付列表
        Route::get('order/substitutePayChargeList','Order\OrdersController@substitutePayChargeList');
        //代付按钮
        Route::get('order/substitutePay','Order\OrdersController@substitutePay');

        //用户信息
        Route::get('userinfo','User\UserController@index');
        //签到记录
        Route::get('user/sign_record','User\UserController@signRecord');
        Route::get('user/sign','User\UserController@sign');
        //催更
        Route::get('user/urgeUpdate','User\UserController@urgeUpdate');

        // 测试登录
//         Route::any('user/test_add_user_login_cookie','User\UserController@test_add_user_login_cookie');
        
//         // 用户免费分享
//         Route::any('user/FreeShare','User\UserFreeShareController@FreeShare');
//         // 用户免费分享统计
//         Route::any('user/add_free_share_visitstat','User\UserFreeShareController@add_free_share_visitstat');

        

        //书架
        Route::get('userShelfBooks','User\UserShelfBooksController@index');
        //添加书架
        Route::post('userShelfBooks','User\UserShelfBooksController@addShelf');
        //删除书架
        Route::get('userShelfBooks/delete','User\UserShelfBooksController@delShelf');

        Route::get('userShelfBooks/isonshelf','User\UserShelfBooksController@isOnshelf');
        //阅读器用户分享统计
        Route::get('user/recordShare','User\UserController@recordShare');
        //广告统计
        Route::post('user/advisitstat','User\UserController@adVisitStat');

        //阅读记录
        Route::get('readrecord','User\ReadRecordController@index');
        //添加阅读记录
        Route::post('readrecord','User\ReadRecordController@addReadRecord');
        //删除阅读记录
        Route::get('readrecord/delete','User\ReadRecordController@delReadRecord');
        //获取强关二维码
        Route::get('subscribe/qrcode','Subscribe\SubscribeController@getSubscribeQrcode');

        Route::post('error/undefinedCollect','Other\ErrorCollectionController@undefinedCollect');
        Route::post('activity/getCoupons','User\UserController@getCoupons');

        //章节评论
        Route::post('chapter/comment','Book\ChapterController@commentChapter');
        Route::get('chapter/getComment','Book\ChapterController@getChapterComment');

        //书籍送礼
        Route::get('gift/getGiftsList','Book\BooksGiftController@getAllGifts');
        Route::post('gift/sendGifts','Book\BooksGiftController@sendGifts');
        Route::get('gift/getUserSendGiftsRecord','Book\BooksGiftController@getUserSendGiftsRecordV2');
        Route::get('gift/getUserGiftsConsumeRecord','Book\BooksGiftController@getSendGiftsForConsumeRecord');
        //分享签名
        Route::get('chapter/getWechatJsConfig','Book\ChapterController@getWechatJsConfig');

    });

    //授权回掉
    Route::get('/oauthCallBack','Oauth\UsersController@wcback');

    Route::get('/oauthCallBackV2','Oauth\UsersController@wcbackV2');

    Route::get('/oauthCallBacktest','Oauth\UsersController@wcbackTest');

    Route::get('/testauth','Web\RedirectController@testauth');

    //退出 测试
    Route::get('logout','User\UserController@logout');

    Route::get('clearcookie','Web\RedirectController@clearCookie');

    //需要微信授权
    Route::group(['middleware'=>'ReadOauth'],function (){

        //推广链接
        Route::get('yun/{param}','Web\RedirectController@index')->where('param','\d+');
        //活动推送
        Route::get('push/activity','Web\WelcomeController@activity');
        Route::get('sale/activity','Web\WelcomeController@channelActivity');
        Route::get('sale/springactivity','Web\WelcomeController@springActivity');
        Route::get('sale/womenactivity','Web\WelcomeController@womenActivity');
        Route::get('sale/newUserActivity','Web\WelcomeController@newUserActivity');

        Route::get('sale/channelsalenine','Web\WelcomeController@channelActivityNine');
        Route::get('sale/channelsalesixty','Web\WelcomeController@channelActivitySixtyEight');
        Route::get('sale/channelsaleforty','Web\WelcomeController@channelActivityFortyEight');
        Route::get('sale/qingMingActivity','Web\WelcomeController@qingMingActivity');
        Route::get('sale/readDayActivity','Web\WelcomeController@readDayActivity');
        Route::get('sale/laborDayActivity','Web\WelcomeController@readDayActivity');
        Route::get('sale/yearActivity','Web\WelcomeController@yearActivity');
        Route::get('sale','Web\WelcomeController@commonActivity');
        Route::get('sale/summer','Web\WelcomeController@summerActivity');
        Route::get('sale/newUserSale','Web\WelcomeController@newUserSale');
        Route::get('sale/nationday','Web\WelcomeController@nationalDayActivity');
        Route::get('sale/chongyang','Web\WelcomeController@cYactivity');
        Route::get('sale/newUserForeverActivity','Web\WelcomeController@newUserForeverActivity');
        Route::get('sale/tempC','Web\WelcomeController@tempC');

        Route::get('sale/seYearActivity','Web\WelcomeController@otherYearActivity');
        Route::get('sale/shoppingDayActivity','Web\WelcomeController@shoppingDayActivity');
        Route::get('sale/thanksGivingDayActivity','Web\WelcomeController@thanksGivingDayActivity');

        Route::get('sale/greatcold','Web\WelcomeController@greatColdActivity');
        Route::get('sale/vernalequinox','Web\WelcomeController@vernalEquinoxActivity');
        Route::get('sale/customvip','Web\WelcomeController@channelYearActivity');
        //继续阅读
        Route::get('continue','User\ReadRecordController@latestRead');

        //用户强关信息页
        Route::any('subscribe/getFromUser','Subscribe\SubscribeController@getFromUser');

        Route::any('{slug}','Web\WelcomeController@index')->where('slug', '(.*)?');

    });

});

