api.php 14 KB

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