api.php 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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. $api->post('/user_detail', 'HomeController@user_detail')->name('home.user_detail');
  31. $api->post('/user_dynamic', 'HomeController@user_dynamic')->name('home.user_dynamic');
  32. });
  33. /*
  34. |--------------------------------------------------------------
  35. | 动态相关
  36. |--------------------------------------------------------------
  37. */
  38. $api->group(['prefix' => 'dynamic'], function ($api) {
  39. $api->post('/get_tag_list', 'DynamicController@get_tag_list')->name('dynamic.get_tag_list');
  40. $api->post('/get_list', 'DynamicController@get_list')->name('dynamic.get_list');
  41. $api->get('/dynamic_info', 'DynamicController@dynamic_info')->name('dynamic.dynamic_info');
  42. });
  43. /*
  44. |--------------------------------------------------------------
  45. | 登录相关
  46. |--------------------------------------------------------------
  47. */
  48. $api->group(['prefix' => 'login'], function ($api) {
  49. $api->post('/login_by_mobile', 'AuthorizationsController@login_by_mobile')->name('login.mobile');
  50. $api->post('/login_by_password', 'AuthorizationsController@login_by_account_password')->name('login.password');
  51. $api->post('/forget_password', 'AuthorizationsController@forget_password')->name('login.forget');
  52. $api->post('/register', 'AuthorizationsController@register')->name('login.register');
  53. $api->get('/xieyi', 'AuthorizationsController@xieyi')->name('login.xieyi');
  54. $api->get('/captcha', 'AuthorizationsController@captcha')->name('login.captcha');
  55. $api->post('/reg_h5', 'AuthorizationsController@reg_h5')->name('login.reg_h5');
  56. });
  57. /*
  58. |--------------------------------------------------------------
  59. | 获取oss上传配置
  60. |--------------------------------------------------------------
  61. */
  62. $api->group(['prefix' => 'upload-config'], function ($api) {
  63. $api->get('/config', 'UploadConfigController@config')->name('upload.config');
  64. });
  65. /*
  66. |--------------------------------------------------------------
  67. | 发送短信验证码
  68. |--------------------------------------------------------------
  69. */
  70. $api->group(['prefix' => 'sms'], function ($api) {
  71. $api->get('/send', 'SmsController@send')->name('sms.send');
  72. });
  73. });
  74. //需要 token 验证的接口
  75. $api->group(['middleware' => 'api.auth'], function ($api) {
  76. /*
  77. |--------------------------------------------------------------
  78. | 用户信息相关
  79. |--------------------------------------------------------------
  80. */
  81. $api->group(['prefix' => 'user'], function ($api) {
  82. //设置性别
  83. $api->post('/checksex', 'UserController@checksex')->name('user.checksex');
  84. //设置资料(初次注册进入时)
  85. $api->post('/setinfo', 'UserController@setinfo')->name('user.setinfo');
  86. $api->post('/setpass', 'UserController@setpass')->name('user.setpass');
  87. $api->get('/getinfo', 'UserController@getinfo')->name('user.getinfo');
  88. $api->get('/get_photo', 'UserController@get_photo')->name('user.get_photo');
  89. $api->post('/upload_file', 'UserController@upload_file')->name('user.upload_file');
  90. $api->post('/updateinfo', 'UserController@updateinfo')->name('user.updateinfo');
  91. $api->post('/problem', 'UserController@problem')->name('user.problem');
  92. $api->post('/looked_me', 'UserController@looked_me')->name('user.looked_me');
  93. $api->get('/get_vip', 'UserController@get_vip')->name('user.get_vip');
  94. $api->post('/buy_vip', 'UserController@buy_vip')->name('user.buy_vip');
  95. $api->post('/check_auth', 'UserController@check_auth')->name('user.check_auth');
  96. $api->post('/black_list', 'UserController@black_list')->name('user.black_list');
  97. $api->post('/del_black', 'UserController@del_black')->name('user.del_black');
  98. $api->post('/online_status', 'UserController@online_status')->name('user.online_status');
  99. $api->get('/get_vip_info', 'UserController@get_vip_info')->name('user.get_vip_info');
  100. });
  101. /*
  102. |--------------------------------------------------------------
  103. | 动态相关
  104. |--------------------------------------------------------------
  105. */
  106. $api->group(['prefix' => 'dynamic'], function ($api) {
  107. $api->post('/release', 'DynamicController@release')->name('dynamic.release');
  108. $api->post('/my_list', 'DynamicController@my_list')->name('dynamic.my_list');
  109. $api->post('/zan', 'DynamicController@zan')->name('dynamic.zan');
  110. $api->post('/del', 'DynamicController@del')->name('dynamic.del');
  111. $api->post('/report', 'DynamicController@report')->name('dynamic.report');
  112. });
  113. /*
  114. |--------------------------------------------------------------
  115. | 首页内容
  116. |--------------------------------------------------------------
  117. */
  118. $api->group(['prefix' => 'home'], function ($api) {
  119. $api->post('/do_like', 'HomeController@do_like')->name('home.do_like');
  120. $api->post('/do_comment', 'HomeController@do_comment')->name('home.do_comment');
  121. $api->post('/get_weixin', 'HomeController@get_weixin')->name('home.get_weixin');
  122. });
  123. /*
  124. |--------------------------------------------------------------
  125. | 消息相关
  126. |--------------------------------------------------------------
  127. */
  128. $api->group(['prefix' => 'notice'], function ($api) {
  129. $api->post('/get_notice_list', 'NoticeController@get_notice_list')->name('notice.get_notice_list');
  130. $api->post('/get_like_list', 'NoticeController@get_like_list')->name('notice.get_like_list');
  131. $api->post('/get_zan_list', 'NoticeController@get_zan_list')->name('notice.get_zan_list');
  132. $api->post('/get_system_message', 'NoticeController@get_system_message')->name('notice.get_system_message');
  133. });
  134. /*
  135. |--------------------------------------------------------------
  136. | 聊天相关
  137. |--------------------------------------------------------------
  138. */
  139. $api->group(['prefix' => 'chat'], function ($api) {
  140. $api->post('/add_friend', 'ChatController@add_friend')->name('chat.add_friend');
  141. $api->post('/get_friend', 'ChatController@get_friend')->name('chat.get_friend');
  142. });
  143. /*
  144. |--------------------------------------------------------------
  145. | 文件上传
  146. |--------------------------------------------------------------
  147. */
  148. $api->post('/upload', 'UploadController@upload')->name('upload');
  149. /*
  150. |--------------------------------------------------------------
  151. | 退出登录
  152. |--------------------------------------------------------------
  153. */
  154. $api->put('/logout', 'AuthorizationsController@logout')->name('logout');
  155. });
  156. /*
  157. |--------------------------------------------------------------
  158. | 支付回调
  159. |--------------------------------------------------------------
  160. */
  161. $api->any('/wx_notify', 'PayNotifyController@wx_notify')->name('wx_notify');
  162. $api->any('/ali_notify', 'PayNotifyController@ali_notify')->name('ali_notify');
  163. $api->any('/creat_user', 'TestController@creat_user')->name('creat_user');
  164. $api->any('/create_dynamic', 'TestController@create_dynamic')->name('create_dynamic');
  165. $api->any('/test_push', 'TestController@test_push')->name('test_push');
  166. });