api.php 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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. $api->post('/auth_login', 'AuthorizationsController@auth_login')->name('login.auth_login');
  57. });
  58. /*
  59. |--------------------------------------------------------------
  60. | 获取oss上传配置
  61. |--------------------------------------------------------------
  62. */
  63. $api->group(['prefix' => 'upload-config'], function ($api) {
  64. $api->get('/config', 'UploadConfigController@config')->name('upload.config');
  65. });
  66. /*
  67. |--------------------------------------------------------------
  68. | 发送短信验证码
  69. |--------------------------------------------------------------
  70. */
  71. $api->group(['prefix' => 'sms'], function ($api) {
  72. $api->get('/send', 'SmsController@send')->name('sms.send');
  73. });
  74. });
  75. //需要 token 验证的接口
  76. $api->group(['middleware' => 'api.auth',
  77. 'limit' => config('api.rate_limits.access.limit'),
  78. 'expires' => config('api.rate_limits.access.expires')], function ($api) {
  79. /*
  80. |--------------------------------------------------------------
  81. | 用户信息相关
  82. |--------------------------------------------------------------
  83. */
  84. $api->group(['prefix' => 'user'], function ($api) {
  85. //设置性别
  86. $api->post('/checksex', 'UserController@checksex')->name('user.checksex');
  87. //设置资料(初次注册进入时)
  88. $api->post('/setinfo', 'UserController@setinfo')->name('user.setinfo');
  89. $api->post('/setpass', 'UserController@setpass')->name('user.setpass');
  90. $api->get('/getinfo', 'UserController@getinfo')->name('user.getinfo');
  91. $api->get('/get_photo', 'UserController@get_photo')->name('user.get_photo');
  92. $api->post('/upload_file', 'UserController@upload_file')->name('user.upload_file');
  93. $api->post('/updateinfo', 'UserController@updateinfo')->name('user.updateinfo');
  94. $api->post('/problem', 'UserController@problem')->name('user.problem');
  95. $api->post('/looked_me', 'UserController@looked_me')->name('user.looked_me');
  96. $api->get('/get_vip', 'UserController@get_vip')->name('user.get_vip');
  97. $api->post('/buy_vip', 'UserController@buy_vip')->name('user.buy_vip');
  98. $api->post('/check_auth', 'UserController@check_auth')->name('user.check_auth');
  99. $api->post('/black_list', 'UserController@black_list')->name('user.black_list');
  100. $api->post('/del_black', 'UserController@del_black')->name('user.del_black');
  101. $api->post('/online_status', 'UserController@online_status')->name('user.online_status');
  102. $api->get('/get_vip_info', 'UserController@get_vip_info')->name('user.get_vip_info');
  103. $api->get('/invite_info', 'UserController@invite_info')->name('user.invite_info');
  104. $api->post('/get_invite_list', 'UserController@get_invite_list')->name('user.get_invite_list');
  105. $api->get('/receive_day', 'UserController@receive_day')->name('user.receive_day');
  106. $api->post('/del_file', 'UserController@del_file')->name('user.del_file');
  107. $api->post('/photo_destroy', 'UserController@photo_destroy')->name('user.photo_destroy');
  108. });
  109. /*
  110. |--------------------------------------------------------------
  111. | 动态相关
  112. |--------------------------------------------------------------
  113. */
  114. $api->group(['prefix' => 'dynamic'], function ($api) {
  115. $api->post('/release', 'DynamicController@release')->name('dynamic.release');
  116. $api->post('/my_list', 'DynamicController@my_list')->name('dynamic.my_list');
  117. $api->post('/zan', 'DynamicController@zan')->name('dynamic.zan');
  118. $api->post('/del', 'DynamicController@del')->name('dynamic.del');
  119. $api->post('/report', 'DynamicController@report')->name('dynamic.report');
  120. });
  121. /*
  122. |--------------------------------------------------------------
  123. | 首页内容
  124. |--------------------------------------------------------------
  125. */
  126. $api->group(['prefix' => 'home'], function ($api) {
  127. $api->post('/do_like', 'HomeController@do_like')->name('home.do_like');
  128. $api->post('/do_comment', 'HomeController@do_comment')->name('home.do_comment');
  129. $api->post('/get_weixin', 'HomeController@get_weixin')->name('home.get_weixin');
  130. });
  131. /*
  132. |--------------------------------------------------------------
  133. | 消息相关
  134. |--------------------------------------------------------------
  135. */
  136. $api->group(['prefix' => 'notice'], function ($api) {
  137. $api->post('/get_notice_list', 'NoticeController@get_notice_list')->name('notice.get_notice_list');
  138. $api->post('/get_like_list', 'NoticeController@get_like_list')->name('notice.get_like_list');
  139. $api->post('/get_zan_list', 'NoticeController@get_zan_list')->name('notice.get_zan_list');
  140. $api->post('/get_system_message', 'NoticeController@get_system_message')->name('notice.get_system_message');
  141. $api->post('/del_system_message', 'NoticeController@del_system_message')->name('notice.del_system_message');
  142. });
  143. /*
  144. |--------------------------------------------------------------
  145. | 聊天相关
  146. |--------------------------------------------------------------
  147. */
  148. $api->group(['prefix' => 'chat'], function ($api) {
  149. $api->post('/add_friend', 'ChatController@add_friend')->name('chat.add_friend');
  150. $api->post('/get_friend', 'ChatController@get_friend')->name('chat.get_friend');
  151. });
  152. /*
  153. |--------------------------------------------------------------
  154. | 文件上传
  155. |--------------------------------------------------------------
  156. */
  157. $api->post('/upload', 'UploadController@upload')->name('upload');
  158. /*
  159. |--------------------------------------------------------------
  160. | 退出登录
  161. |--------------------------------------------------------------
  162. */
  163. $api->put('/logout', 'AuthorizationsController@logout')->name('logout');
  164. });
  165. /*
  166. |--------------------------------------------------------------
  167. | 支付回调
  168. |--------------------------------------------------------------
  169. */
  170. $api->any('/wx_notify', 'PayNotifyController@wx_notify')->name('wx_notify');
  171. $api->any('/ali_notify', 'PayNotifyController@ali_notify')->name('ali_notify');
  172. $api->any('/creat_user', 'TestController@creat_user')->name('creat_user');
  173. $api->any('/create_dynamic', 'TestController@create_dynamic')->name('create_dynamic');
  174. $api->any('/test_push', 'TestController@test_push')->name('test_push');
  175. $api->any('/jg_auth', 'TestController@jg_auth')->name('jg_auth');
  176. });