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


Route::group(['domain'=>env('XCHENGXU_DOMAIN'),'namespace'=>'App\Http\Controllers\Xchengxu'],function(){
    //支付会掉
    Route::any('pay/wcback_xchengxu','Order\OrdersController@wcback_official');
    Route::any('help','Web\RedirectController@help');
    Route::post('api/login','Oauth\UsersController@index');
    Route::get('api/RefreshToken','Oauth\UsersController@RefreshToken');
    //支付回调
    Route::any('pay/wcback','Order\OrdersController@wxback_xcx');
    Route::group(['prefix'=>'api'],function (){
        //首页
        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');
        //排行榜
        Route::get('books/rank','Book\BookController@rank');
        //分类列表
        Route::get('books/getCategory','Book\BookCategoryController@getCategory');
    });
    //web 接口  jwttoken
    Route::group(['prefix'=>'api','middleware'=>'jwttoken'],function () {

        //图书详情
        Route::get('book/{bid}','Book\BookController@index');

        //目录不分页
        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('userinfo','User\UserController@index');


        //书架
        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('readrecord','User\ReadRecordController@index');
        //添加阅读记录
        Route::post('readrecord','User\ReadRecordController@addReadRecord');
        //删除阅读记录
        Route::get('readrecord/delete','User\ReadRecordController@delReadRecord');

        //支付
        Route::get('goToPay','Order\OrdersController@wxindex');

        Route::get('checkOrder','Order\OrdersController@checkOrder');
    });

});

