version('v1', ['namespace' => 'App\Http\Controllers\V1'], function ($api) { /* |-------------------------------------------------------------- | 不需要token验证的接口 |-------------------------------------------------------------- */ $api->group([ 'middleware' => ['throttle:120'], //代表1分钟内接口最高请求次数,超出返回 429: Too Many Attempts ], function ($api) { $api->post('sms/send', 'SmsController@send'); //发送手机验证码 $api->post('email/send', 'SmsController@sendEmailCode'); //发送邮箱验证码 $api->post('attachment/upload', 'AttachmentController@upload'); //上传附件 $api->post('attachment/delete', 'AttachmentController@delete'); //删除附件 $api->get('privacy', 'IndexController@privacyPolice'); //隐私政策 $api->get('agreement', 'IndexController@userAgreement'); //用户协议 }); $api->group(['prefix' => 'auth'], function ($api) { $api->post('login', 'AuthController@login'); //账号密码登录 $api->post('register', 'AuthController@register'); //注册 $api->post('auth_login', 'AuthController@authLogin'); //APP第三方授权登录(微信) $api->post('decrypt_phone', 'AuthController@decryptPhone'); //微信小程序获取手机号 $api->post('h5_oauth', 'AuthController@h5Oauth'); //H5授权登录 $api->post('mini_program', 'AuthController@miniProgram'); //微信小程序登录(微信) $api->get('mini_code', 'AuthController@miniCode'); //获取微信小程序 code $api->post('bytedance', 'AuthController@bytedance'); //获取字节跳动小程序 code $api->post('kuaishou', 'AuthController@kuaishou'); //获取快手小程序 code $api->post('wechat', 'AuthController@wechat'); //获取微信小程序 code }); $api->group(['prefix' => 'index'], function ($api) { $api->get('all_region', 'IndexController@allRegion'); //全国省市区 $api->get('helps', 'IndexController@helpList'); //帮助类型 $api->get('answer', 'IndexController@answer'); //问题答案 }); /* |-------------------------------------------------------------- | 需要 token 验证的接口 'middleware' => ['api.auth'] 读取的 config/api.php 'auth' => ['jwt' => 'Dingo\Api\Auth\Provider\JWT'], 所以 在 Kernel.php 找不到这个中间件 |-------------------------------------------------------------- */ $api->group([ 'middleware' => ['api.auth', 'throttle:120'], ], function ($api) { /* @var Dingo\Api\Routing\Router $api*/ $api->post('auth/logout', 'AuthController@logout'); //退出登录 $api->post('auth/forget_password', 'AuthController@forgetPassword'); //忘记密码 $api->group(['prefix' => 'user'], function($api){ /* @var Dingo\Api\Routing\Router $api*/ $api->post('h5_bind', 'UserController@h5Bind'); //H5绑定 $api->post('h5_rebind', 'UserController@h5Rebind'); //H5解绑 $api->post('mini_program_bind', 'UserController@miniProgramBind'); //微信小程序绑定 $api->post('mini_program_rebind', 'UserController@miniProgramReBind'); //微信小程序解绑 $api->post('sms_bind', 'UserController@smsBind'); //手机号绑定 $api->post('sms_rebind', 'UserController@smsReBind'); //手机号解绑 $api->get('group_by_initial', 'UserController@groupByInitial'); //用户列表按照首字母分组排序,类似手机通讯录 $api->post('feedback', 'UserController@feedback'); //问题反馈 $api->get('info', 'UserController@info'); //用户信息 $api->post('update', 'UserController@update'); //更新用户信息 $api->post('{id}/bind', 'UserController@bind'); //绑定上级 $api->group(['namespace' => 'User'], function ($api){ /* @var Dingo\Api\Routing\Router $api*/ // 观看记录相关 $api->group(['prefix' => 'watch'], function ($api){ /* @var Dingo\Api\Routing\Router $api*/ $api->get('record', 'WatchRecordsController@lists'); $api->post('{id}/destroy', 'WatchRecordsController@destroy'); $api->get('recent', 'WatchRecordsController@recent'); $api->post('episode', 'WatchRecordsController@watched'); }); // 消费相关 $api->group(['prefix' => 'consume'], function ($api){ /* @var Dingo\Api\Routing\Router $api*/ $api->get('record', 'ConsumeController@record'); }); // 充值相关 $api->group(['prefix' => 'recharge'], function ($api){ /* @var Dingo\Api\Routing\Router $api*/ $api->get('record', 'RechargeController@record'); $api->post('create/order', 'RechargeController@createOrder'); }); // VIP相关 $api->group(['prefix' => 'vip'], function ($api){ /* @var Dingo\Api\Routing\Router $api*/ $api->get('setting', 'VipController@setting'); $api->get('last', 'VipController@last'); $api->post('create/order', 'VipController@createOrder'); }); // 收藏相关 $api->group(['prefix' => 'collect'], function ($api){ /* @var Dingo\Api\Routing\Router $api*/ $api->get('record', 'CollectController@record'); $api->post('{id}/check', 'CollectController@check'); $api->post('{id}/add', 'CollectController@add'); $api->post('{id}/destroy', 'CollectController@destroy'); }); // 喜欢相关 $api->group(['prefix' => 'favorite'], function ($api){ /* @var Dingo\Api\Routing\Router $api*/ $api->post('{id}/check', 'FavoriteController@check'); $api->post('{id}/add', 'FavoriteController@add'); $api->post('{id}/destroy', 'FavoriteController@destroy'); }); // 签到相关 $api->group(['prefix' => 'sign'], function ($api){ /* @var Dingo\Api\Routing\Router $api*/ $api->get('setting', 'SignController@setting'); $api->post('handle', 'SignController@handle'); }); // 用户剧集 $api->group(['prefix' => 'episode'], function ($api){ /* @var Dingo\Api\Routing\Router $api*/ $api->get('buy/{episode}/record', 'EpisodeController@buyRecord'); $api->post('{episode}/{list}/buy', 'EpisodeController@buy'); }); }); }); // 相关设置 $api->group(['prefix' => 'setting'],function ($api){ /* @var Dingo\Api\Routing\Router $api*/ $api->get('tabBar', 'SettingController@tabBar'); // 底部导航 $api->get('navBar', 'SettingController@navBar'); // 首页顶部分类 $api->get('banner', 'SettingController@banner'); // banner $api->get('homeColumn', 'SettingController@homeColumn'); // homeColumn $api->get('rechargeCombo', 'SettingController@rechargeCombo'); // 充值 $api->get('config', 'SettingController@config'); // 相关设置 }); // 相关设置 $api->group(['prefix' => 'setting'],function ($api){ /* @var Dingo\Api\Routing\Router $api*/ $api->get('tabBar', 'SettingController@tabBar'); // 底部导航 $api->get('navBar', 'SettingController@navBar'); // 首页顶部分类 $api->get('banner', 'SettingController@banner'); // banner $api->get('homeColumn', 'SettingController@homeColumn'); // homeColumn $api->get('rechargeCombo', 'SettingController@rechargeCombo'); // 充值 }); // 分销 $api->group(['namespace' => 'Share', 'prefix' => 'share'],function ($api){ /* @var Dingo\Api\Routing\Router $api*/ $api->get('order/lists', 'OrderController@lists'); // 分销订单 $api->get('team/lists', 'TeamController@lists'); // 分销订单 $api->get('withdraw/lists', 'WithdrawController@lists'); // 分销订单 $api->post('withdraw/create', 'WithdrawController@create'); // 分销订单 $api->get('income', 'ShareController@income'); // 分销明细 $api->get('tips', 'ShareController@tips'); // 用户需知 $api->get('setting', 'ShareController@setting'); // 设置 $api->post('generate/qrcode', 'ShareController@generateQrcode'); // 生成二维码 }); // 短剧 $api->group(['prefix' => 'episode'],function ($api){ /* @var Dingo\Api\Routing\Router $api*/ $api->get('recommend', 'EpisodeController@recommend'); // 推荐 $api->get('today/recommend', 'EpisodeController@todayRecommend'); // 今日推荐 $api->get('news', 'EpisodeController@news'); // 最新 $api->get('rank', 'EpisodeController@rank'); // 排行 $api->get('trace', 'EpisodeController@trace'); // 追剧 $api->get('list', 'EpisodeController@list'); // 列表 $api->get('search', 'EpisodeController@search'); // 搜索 $api->get('vip/free', 'EpisodeController@vipFree'); // banner $api->get('{id}/detail', 'EpisodeController@detail'); // 详情 $api->get('/list/{listId}/buyNum', 'EpisodeController@listBuyNum'); // 详情 }); }); $api->get('pay/{pay_id}/query', 'PayController@query'); //字节跳动支付 $api->any('pay/bytedance/notify', 'PayNoticeController@bytedance'); //字节跳动支付回调 $api->any('pay/kuaishou/notify', 'PayNoticeController@kuaishou'); //快手支付回调 $api->any('pay/wechat/notify', 'PayNoticeController@wechat'); //微信支付回调 });