api.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <?php
  2. use Illuminate\Support\Facades\Route;
  3. use App\Http\Controllers\V1\Ai\AiController;
  4. // Router::addRoute(['GET', 'POST', 'HEAD'], '/api/wechat/pay/aiCallback', 'App\Http\Controllers\V1\PayNoticeController@wechat');
  5. // Route::middleware(['apiLogs'])->group(function () {
  6. // Route::any('/buildStory',[AiController::class,'buildStory']);
  7. // });
  8. // Route::post('/buildStory',[AiController::class,'buildStory']);
  9. $api = app('Dingo\Api\Routing\Router');
  10. $api->version('v1', ['namespace' => 'App\Http\Controllers\V1'], function ($api) {
  11. /*
  12. |--------------------------------------------------------------
  13. | 不需要token验证的接口
  14. |--------------------------------------------------------------
  15. */
  16. $api->group([
  17. 'middleware' => ['apiLogs', 'throttle:120'], // 代表1分钟内接口最高请求次数,超出返回 429: Too Many Attempts
  18. ], function ($api) {
  19. $api->post('wechat/pay/aiCallback', 'PayNoticeController@wechat'); // banner
  20. // $api->post('buildStory', 'Ai/AiController@send'); //发送手机验证码
  21. $api->post('sms/send', 'SmsController@send'); // 发送手机验证码
  22. $api->post('email/send', 'SmsController@sendEmailCode'); // 发送邮箱验证码
  23. $api->post('attachment/upload', 'AttachmentController@upload'); // 上传附件
  24. $api->post('attachment/delete', 'AttachmentController@delete'); // 删除附件
  25. $api->get('privacy', 'IndexController@privacyPolice'); // 隐私政策
  26. $api->get('agreement', 'IndexController@userAgreement'); // 用户协议
  27. $api->get('getHandpick', 'IndexController@getHandpick'); // 用户协议
  28. $api->get('payConfig', 'IndexController@payConfig'); // 用户协议
  29. $api->post('avatar/upload', 'UserController@upload'); // 上传
  30. $api->get('banner', 'SettingController@banner'); // banner
  31. $api->get('getServiceConfig', 'IndexController@getServiceConfig'); // banner
  32. $api->get('getConfigByKey', 'IndexController@getConfigByKey'); // 通过key获取配置
  33. });
  34. $api->group(['namespace' => 'Ai'], function ($api) {
  35. /* @var Dingo\Api\Routing\Router $api */
  36. // 观看记录相关
  37. $api->group(['prefix' => 'ai'], function ($api) {
  38. /* @var Dingo\Api\Routing\Router $api */
  39. $api->any('buildStory', 'AiController@buildStory');
  40. $api->any('buildTitle', 'AiController@buildTitle');
  41. $api->any('buildKeyword', 'AiController@buildKeyword');
  42. $api->any('buildSd', 'AiController@buildSd');
  43. $api->any('getOpensdDetail', 'AiController@getOpensdDetail');
  44. $api->any('generate_pdf', 'AiController@generate_pdf');
  45. $api->any('buildPinyin', 'AiController@buildPinyin');
  46. $api->get('Pinyin', 'AiController@Pinyin');
  47. });
  48. });
  49. $api->group(['prefix' => 'auth'], function ($api) {
  50. $api->post('login', 'AuthController@login'); // 账号密码登录
  51. $api->post('register', 'AuthController@register'); // 注册
  52. $api->post('auth_login', 'AuthController@authLogin'); // APP第三方授权登录(微信)
  53. $api->post('decrypt_phone', 'AuthController@decryptPhone'); // 微信小程序获取手机号
  54. $api->post('h5_oauth', 'AuthController@h5Oauth'); // H5授权登录
  55. $api->post('mini_program', 'AuthController@miniProgram'); // 微信小程序登录(微信)
  56. $api->get('mini_code', 'AuthController@miniCode'); // 获取微信小程序 code
  57. $api->post('bytedance', 'AuthController@bytedance'); // 获取字节跳动小程序 code
  58. $api->post('kuaishou', 'AuthController@kuaishou'); // 获取快手小程序 code
  59. $api->post('wechat', 'AuthController@wechat'); // 获取微信小程序 code
  60. });
  61. $api->group(['prefix' => 'index'], function ($api) {
  62. $api->get('all_region', 'IndexController@allRegion'); // 全国省市区
  63. $api->get('helps', 'IndexController@helpList'); // 帮助类型
  64. $api->get('answer', 'IndexController@answer'); // 问题答案
  65. });
  66. $api->any('test', 'TestController@index'); // test api
  67. /*
  68. |--------------------------------------------------------------
  69. | 需要 token 验证的接口 'middleware' => ['api.auth'] 读取的 config/api.php 'auth' => ['jwt' => 'Dingo\Api\Auth\Provider\JWT'], 所以 在 Kernel.php 找不到这个中间件
  70. |--------------------------------------------------------------
  71. */
  72. $api->group([
  73. 'middleware' => ['apiLogs', 'checkAuth', 'api.auth', 'throttle:120'],
  74. ], function ($api) {
  75. /* @var Dingo\Api\Routing\Router $api */
  76. $api->post('auth/logout', 'AuthController@logout'); // 退出登录
  77. $api->post('auth/forget_password', 'AuthController@forgetPassword'); // 忘记密码
  78. $api->group(['namespace' => 'Ai'], function ($api) {
  79. $api->group(['prefix' => 'ai'], function ($api) {
  80. $api->post('submitTask', 'AiController@submitTask'); // 提交任务
  81. $api->get('getTaskDetail', 'AiController@getTaskDetail'); // 获取任务详情
  82. $api->get('downloadPdf', 'AiController@downloadPdf'); // 下载pdf
  83. });
  84. });
  85. $api->group(['prefix' => 'user'], function ($api) {
  86. /* @var Dingo\Api\Routing\Router $api */
  87. $api->post('h5_bind', 'UserController@h5Bind'); // H5绑定
  88. $api->post('h5_rebind', 'UserController@h5Rebind'); // H5解绑
  89. $api->post('mini_program_bind', 'UserController@miniProgramBind'); // 微信小程序绑定
  90. $api->post('mini_program_rebind', 'UserController@miniProgramReBind'); // 微信小程序解绑
  91. $api->post('sms_bind', 'UserController@smsBind'); // 手机号绑定
  92. $api->post('sms_rebind', 'UserController@smsReBind'); // 手机号解绑
  93. $api->get('group_by_initial', 'UserController@groupByInitial'); // 用户列表按照首字母分组排序,类似手机通讯录
  94. $api->post('feedback', 'UserController@feedback'); // 问题反馈
  95. $api->get('info', 'UserController@info'); // 用户信息
  96. $api->get('parent', 'UserController@parent'); // 用户信息
  97. $api->post('update', 'UserController@update'); // 更新用户信息
  98. $api->post('{id}/bind', 'UserController@bind'); // 绑定上级
  99. $api->post('applyShare', 'UserController@applyShare'); // 申请推广大使
  100. $api->get('myTeam', 'UserController@myTeam'); // 我的团队
  101. $api->get('myGiveaway', 'UserController@myGiveaway'); // 我的分佣
  102. $api->post('userWithdraw', 'UserController@userWithdraw'); // 用户提现
  103. $api->get('userWithdrawList', 'UserController@userWithdrawList'); // 提现记录
  104. $api->get('myShare', 'UserController@myShare'); // 我的推荐
  105. $api->get('myConsumeList', 'UserController@myConsumeList'); // 我的消费记录
  106. $api->get('myOrderList', 'UserController@myOrderList'); // 我的充值记录
  107. $api->get('myRoleList', 'UserController@myRoleList'); // 我的角色列表
  108. $api->get('getUserRqCode', 'UserController@getUserRqCode'); // 我的角色列表
  109. $api->post('deleteRole', 'UserController@deleteRole'); // 删除角色
  110. $api->post('updateRole', 'UserController@updateRole'); // 更新角色
  111. $api->post('addRole', 'UserController@addRole'); // 添加角色
  112. $api->group(['namespace' => 'User'], function ($api) {
  113. /* @var Dingo\Api\Routing\Router $api */
  114. // 观看记录相关
  115. $api->group(['prefix' => 'watch'], function ($api) {
  116. /* @var Dingo\Api\Routing\Router $api */
  117. $api->get('record', 'WatchRecordsController@lists');
  118. $api->post('{id}/destroy', 'WatchRecordsController@destroy');
  119. $api->get('recent', 'WatchRecordsController@recent');
  120. $api->post('episode', 'WatchRecordsController@watched');
  121. });
  122. // 消费相关
  123. $api->group(['prefix' => 'consume'], function ($api) {
  124. /* @var Dingo\Api\Routing\Router $api */
  125. $api->get('record', 'ConsumeController@record');
  126. });
  127. // 充值相关
  128. $api->group(['prefix' => 'recharge'], function ($api) {
  129. /* @var Dingo\Api\Routing\Router $api */
  130. $api->get('record', 'RechargeController@record');
  131. $api->post('create/order', 'RechargeController@pay');
  132. });
  133. // VIP相关
  134. $api->group(['prefix' => 'vip'], function ($api) {
  135. /* @var Dingo\Api\Routing\Router $api */
  136. $api->get('setting', 'VipController@setting');
  137. $api->get('last', 'VipController@last');
  138. $api->post('create/order', 'VipController@createOrder');
  139. });
  140. // 收藏相关
  141. $api->group(['prefix' => 'collect'], function ($api) {
  142. /* @var Dingo\Api\Routing\Router $api */
  143. $api->get('record', 'CollectController@record');
  144. $api->post('{id}/check', 'CollectController@check');
  145. $api->post('{id}/add', 'CollectController@add');
  146. $api->post('{id}/destroy', 'CollectController@destroy');
  147. });
  148. // 喜欢相关
  149. $api->group(['prefix' => 'favorite'], function ($api) {
  150. /* @var Dingo\Api\Routing\Router $api */
  151. $api->post('{id}/check', 'FavoriteController@check');
  152. $api->post('{id}/add', 'FavoriteController@add');
  153. $api->post('{id}/destroy', 'FavoriteController@destroy');
  154. });
  155. // 签到相关
  156. $api->group(['prefix' => 'sign'], function ($api) {
  157. /* @var Dingo\Api\Routing\Router $api */
  158. $api->get('setting', 'SignController@setting');
  159. $api->post('handle', 'SignController@handle');
  160. });
  161. // 用户剧集
  162. $api->group(['prefix' => 'episode'], function ($api) {
  163. /* @var Dingo\Api\Routing\Router $api */
  164. $api->get('buy/{episode}/record', 'EpisodeController@buyRecord');
  165. $api->post('{episode}/{list}/buy', 'EpisodeController@buy');
  166. });
  167. });
  168. });
  169. // 相关设置
  170. $api->group(['prefix' => 'setting'], function ($api) {
  171. /* @var Dingo\Api\Routing\Router $api */
  172. $api->get('tabBar', 'SettingController@tabBar'); // 底部导航
  173. $api->get('navBar', 'SettingController@navBar'); // 首页顶部分类
  174. $api->get('homeColumn', 'SettingController@homeColumn'); // homeColumn
  175. $api->get('rechargeCombo', 'SettingController@rechargeCombo'); // 充值
  176. $api->get('config', 'SettingController@config'); // 相关设置
  177. });
  178. // 相关设置
  179. $api->group(['prefix' => 'setting'], function ($api) {
  180. /* @var Dingo\Api\Routing\Router $api */
  181. $api->get('tabBar', 'SettingController@tabBar'); // 底部导航
  182. $api->get('navBar', 'SettingController@navBar'); // 首页顶部分类
  183. $api->get('banner', 'SettingController@banner'); // banner
  184. $api->get('homeColumn', 'SettingController@homeColumn'); // homeColumn
  185. $api->get('rechargeCombo', 'SettingController@rechargeCombo'); // 充值
  186. });
  187. // 分销
  188. $api->group(['namespace' => 'Share', 'prefix' => 'share'], function ($api) {
  189. /* @var Dingo\Api\Routing\Router $api */
  190. $api->get('order/lists', 'OrderController@lists'); // 分销订单
  191. $api->get('team/lists', 'TeamController@lists'); // 分销订单
  192. $api->get('withdraw/lists', 'WithdrawController@lists'); // 分销订单
  193. $api->post('withdraw/create', 'WithdrawController@create'); // 分销订单
  194. $api->get('income', 'ShareController@income'); // 分销明细
  195. $api->get('tips', 'ShareController@tips'); // 用户需知
  196. $api->get('setting', 'ShareController@setting'); // 设置
  197. $api->post('generate/qrcode', 'ShareController@generateQrcode'); // 生成二维码
  198. });
  199. // 短剧
  200. $api->group(['prefix' => 'episode'], function ($api) {
  201. /* @var Dingo\Api\Routing\Router $api */
  202. $api->get('recommend', 'EpisodeController@recommend'); // 推荐
  203. $api->get('today/recommend', 'EpisodeController@todayRecommend'); // 今日推荐
  204. $api->get('news', 'EpisodeController@news'); // 最新
  205. $api->get('rank', 'EpisodeController@rank'); // 排行
  206. $api->get('trace', 'EpisodeController@trace'); // 追剧
  207. $api->get('list', 'EpisodeController@list'); // 列表
  208. $api->get('search', 'EpisodeController@search'); // 搜索
  209. $api->get('vip/free', 'EpisodeController@vipFree'); // banner
  210. $api->get('{id}/detail', 'EpisodeController@detail'); // 详情
  211. $api->get('/list/{listId}/buyNum', 'EpisodeController@listBuyNum'); // 详情
  212. $api->post('{id}/shared', 'EpisodeController@shared'); // 分享
  213. });
  214. });
  215. $api->get('pay/{pay_id}/query', 'PayController@query'); // 字节跳动支付
  216. $api->any('pay/bytedance/notify', 'PayNoticeController@bytedance'); // 字节跳动支付回调
  217. $api->any('pay/bytedance/settle', 'PayNoticeController@bytedanceSettle'); // 字节跳动结算回调
  218. $api->any('pay/kuaishou/notify', 'PayNoticeController@kuaishou'); // 快手支付回调
  219. $api->any('pay/kuaishou/settle', 'PayNoticeController@kuaishouSettle'); // 快手结算回调
  220. $api->any('pay/wechat/notify', 'PayNoticeController@wechat'); // 微信支付回调
  221. });