api.php 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <?php
  2. /*
  3. |--------------------------------------------------------------------------
  4. | API Routes
  5. |--------------------------------------------------------------------------
  6. |
  7. | Here is where you can register API routes for your application. These
  8. | routes are loaded by the RouteServiceProvider within a group which
  9. | is assigned the "api" middleware group. Enjoy building your API!
  10. |
  11. */
  12. $api = app('Dingo\Api\Routing\Router');
  13. $api->version('v1', [
  14. 'namespace' => 'App\Http\Controllers\Api',
  15. 'middleware' => ['serializer:array','cors','activity_log','bindings']
  16. ], function ($api) {
  17. $api->group([
  18. 'middleware' => 'api.throttle',
  19. 'limit' => config('api.rate_limits.access.limit'),
  20. 'expires' => config('api.rate_limits.access.expires')
  21. ], function ($api) {
  22. /*
  23. |--------------------------------------------------------------
  24. | 首页内容
  25. |--------------------------------------------------------------
  26. */
  27. $api->group(['prefix' => 'home'], function ($api) {
  28. $api->post('/home', 'HomeController@home')->name('home.home');
  29. $api->post('/get_location', 'HomeController@get_location')->name('home.get_location');
  30. });
  31. /*
  32. |--------------------------------------------------------------
  33. | 动态相关
  34. |--------------------------------------------------------------
  35. */
  36. $api->group(['prefix' => 'dynamic'], function ($api) {
  37. $api->post('/get_tag_list', 'DynamicController@get_tag_list')->name('dynamic.get_tag_list');
  38. $api->post('/get_list', 'DynamicController@get_list')->name('dynamic.get_list');
  39. $api->get('/dynamic_info', 'DynamicController@dynamic_info')->name('dynamic.dynamic_info');
  40. });
  41. /*
  42. |--------------------------------------------------------------
  43. | 登录相关
  44. |--------------------------------------------------------------
  45. */
  46. $api->group(['prefix' => 'login'], function ($api) {
  47. $api->post('/login_by_mobile', 'AuthorizationsController@login_by_mobile')->name('login.mobile');
  48. $api->post('/login_by_password', 'AuthorizationsController@login_by_password')->name('login.password');
  49. $api->post('/forget_password', 'AuthorizationsController@forget_password')->name('login.forget');
  50. $api->post('/register', 'AuthorizationsController@register')->name('login.register');
  51. $api->get('/xieyi', 'AuthorizationsController@xieyi')->name('login.xieyi');
  52. $api->get('/captcha', 'AuthorizationsController@captcha')->name('login.captcha');
  53. $api->post('/reg_h5', 'AuthorizationsController@reg_h5')->name('login.reg_h5');
  54. });
  55. /*
  56. |--------------------------------------------------------------
  57. | 获取oss上传配置
  58. |--------------------------------------------------------------
  59. */
  60. $api->group(['prefix' => 'upload-config'], function ($api) {
  61. $api->get('/config', 'UploadConfigController@config')->name('upload.config');
  62. });
  63. /*
  64. |--------------------------------------------------------------
  65. | 发送短信验证码
  66. |--------------------------------------------------------------
  67. */
  68. $api->group(['prefix' => 'sms'], function ($api) {
  69. $api->get('/send', 'SmsController@send')->name('sms.send');
  70. });
  71. });
  72. //需要 token 验证的接口
  73. $api->group(['middleware' => 'api.auth'], function ($api) {
  74. /*
  75. |--------------------------------------------------------------
  76. | 用户信息相关
  77. |--------------------------------------------------------------
  78. */
  79. $api->group(['prefix' => 'user'], function ($api) {
  80. //设置性别
  81. $api->post('/checksex', 'UserController@checksex')->name('user.checksex');
  82. //设置资料(初次注册进入时)
  83. $api->post('/setinfo', 'UserController@setinfo')->name('user.setinfo');
  84. $api->post('/setpass', 'UserController@setpass')->name('user.setpass');
  85. $api->get('/getinfo', 'UserController@getinfo')->name('user.getinfo');
  86. $api->get('/get_photo', 'UserController@get_photo')->name('user.get_photo');
  87. $api->post('/upload_file', 'UserController@upload_file')->name('user.upload_file');
  88. $api->post('/updateinfo', 'UserController@updateinfo')->name('user.updateinfo');
  89. $api->post('/problem', 'UserController@problem')->name('user.problem');
  90. $api->post('/looked_me', 'UserController@looked_me')->name('user.looked_me');
  91. $api->get('/get_vip', 'UserController@get_vip')->name('user.get_vip');
  92. $api->post('/buy_vip', 'UserController@buy_vip')->name('user.buy_vip');
  93. $api->post('/check_auth', 'UserController@check_auth')->name('user.check_auth');
  94. $api->post('/black_list', 'UserController@black_list')->name('user.black_list');
  95. $api->post('/del_black', 'UserController@del_black')->name('user.del_black');
  96. });
  97. /*
  98. |--------------------------------------------------------------
  99. | 动态相关
  100. |--------------------------------------------------------------
  101. */
  102. $api->group(['prefix' => 'dynamic'], function ($api) {
  103. $api->post('/release', 'DynamicController@release')->name('dynamic.release');
  104. $api->post('/my_list', 'DynamicController@my_list')->name('dynamic.my_list');
  105. $api->post('/zan', 'DynamicController@zan')->name('dynamic.zan');
  106. $api->post('/del', 'DynamicController@del')->name('dynamic.del');
  107. $api->post('/report', 'DynamicController@report')->name('dynamic.report');
  108. });
  109. /*
  110. |--------------------------------------------------------------
  111. | 消息相关
  112. |--------------------------------------------------------------
  113. */
  114. $api->group(['prefix' => 'notice'], function ($api) {
  115. $api->post('/get_notice_list', 'NoticeController@get_notice_list')->name('notice.get_notice_list');
  116. $api->post('/get_like_list', 'NoticeController@get_like_list')->name('notice.get_like_list');
  117. $api->post('/get_zan_list', 'NoticeController@get_zan_list')->name('notice.get_zan_list');
  118. $api->post('/get_system_message', 'NoticeController@get_system_message')->name('notice.get_system_message');
  119. });
  120. /*
  121. |--------------------------------------------------------------
  122. | 聊天相关
  123. |--------------------------------------------------------------
  124. */
  125. $api->group(['prefix' => 'chat'], function ($api) {
  126. $api->post('/add_friend', 'ChatController@add_friend')->name('chat.add_friend');
  127. $api->post('/get_friend', 'ChatController@get_friend')->name('chat.get_friend');
  128. });
  129. /*
  130. |--------------------------------------------------------------
  131. | 文件上传
  132. |--------------------------------------------------------------
  133. */
  134. $api->post('/upload', 'UploadController@upload')->name('upload');
  135. /*
  136. |--------------------------------------------------------------
  137. | 退出登录
  138. |--------------------------------------------------------------
  139. */
  140. $api->put('/logout', 'AuthorizationsController@logout')->name('logout');
  141. });
  142. /*
  143. |--------------------------------------------------------------
  144. | 支付回调
  145. |--------------------------------------------------------------
  146. */
  147. $api->any('/wx_notify', 'PayNotifyController@wx_notify')->name('wx_notify');
  148. $api->any('/ali_notify', 'PayNotifyController@ali_notify')->name('ali_notify');
  149. $api->any('/creat_user', 'TestController@creat_user')->name('creat_user');
  150. $api->any('/create_dynamic', 'TestController@create_dynamic')->name('create_dynamic');
  151. });