api.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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. //Route::middleware('auth:api')->get('/user', function (Request $request) {
  13. // return $request->user();
  14. //});
  15. $api = app('Dingo\Api\Routing\Router');
  16. $api->version('v1', ['namespace' => 'App\Http\Controllers\Api\V1'], function ($api) {
  17. //附件下载
  18. $api->get('attachment/download/{md5}', [
  19. 'as' => 'attachment.download',
  20. 'uses' => 'AttachmentController@download',
  21. ]);
  22. //附件上传
  23. $api->post('attachment/upload', [
  24. 'as' => 'attachment.upload',
  25. 'uses' => 'AttachmentController@upload',
  26. ]);
  27. //附件删除
  28. $api->get('attachment/delete/{md5}', [
  29. 'as' => 'attachment.delete',
  30. 'uses' => 'AttachmentController@delete',
  31. ]);
  32. //上传头像
  33. $api->post('auth/avatar', [
  34. 'as' => 'auth.avatar',
  35. 'uses' => 'AuthController@avatar',
  36. ]);
  37. // test
  38. $api->get('test', [
  39. 'as' => 'test',
  40. 'uses' => 'AuthController@test',
  41. ]);
  42. // Auth
  43. // signin
  44. $api->post('auth/login', [
  45. 'as' => 'auth.login',
  46. 'uses' => 'AuthController@login',
  47. ]);
  48. $api->get('auth/logout', [
  49. 'as' => 'auth.logout',
  50. 'uses' => 'AuthController@logout',
  51. ]);
  52. $api->post('auth/code', [
  53. 'as' => 'auth.code',
  54. 'uses' => 'AuthController@getCode',
  55. ]);
  56. // signup
  57. $api->post('auth/register', [
  58. 'as' => 'auth.register',
  59. 'uses' => 'AuthController@register',
  60. ]);
  61. $api->post('auth/password', [
  62. 'as' => 'auth.reset',
  63. 'uses' => 'AuthController@setPassword',
  64. ]);
  65. $api->post('auth/check_password', [
  66. 'as' => 'auth.check_password',
  67. 'uses' => 'AuthController@check_password',
  68. ]);
  69. $api->post('auth/reset', [
  70. 'as' => 'auth.reset',
  71. 'uses' => 'AuthController@reset',
  72. ]);
  73. $api->get('auth/is_login', [
  74. 'as' => 'auth.is_login',
  75. 'uses' => 'AuthController@isLogin',
  76. ]);
  77. //首页
  78. $api->get('index/home', [
  79. 'as' => 'index.home',
  80. 'uses' => 'IndexController@home',
  81. ]);
  82. $api->get('index/search', [
  83. 'as' => 'index.search',
  84. 'uses' => 'IndexController@search',
  85. ]);
  86. $api->get('index/user_search', [
  87. 'as' => 'index.user_search',
  88. 'uses' => 'IndexController@userSearch',
  89. ]);
  90. //我的
  91. $api->get('my/show', [
  92. 'as' => 'my.show',
  93. 'uses' => 'MyController@show',
  94. ]);
  95. $api->get('my/persona', [
  96. 'as' => 'my.persona',
  97. 'uses' => 'MyController@persona',
  98. ]);
  99. $api->get('my/edit', [
  100. 'as' => 'my.edit',
  101. 'uses' => 'MyController@edit',
  102. ]);
  103. $api->post('my/update', [
  104. 'as' => 'my.update',
  105. 'uses' => 'MyController@update',
  106. ]);
  107. // 充值
  108. $api->post('my/recharge', [
  109. 'as' => 'my.recharge',
  110. 'uses' => 'MyController@recharge',
  111. ]);
  112. $api->get('my/system_info', [
  113. 'as' => 'my.system_info',
  114. 'uses' => 'MyController@systemInfo',
  115. ]);
  116. $api->get('my/reply_my', [
  117. 'as' => 'my.reply_my',
  118. 'uses' => 'MyController@replyMy',
  119. ]);
  120. $api->get('my/dream', [
  121. 'as' => 'my.dream',
  122. 'uses' => 'MyController@dream',
  123. ]);
  124. // 我的收藏
  125. $api->get('my/collection', [
  126. 'as' => 'my.collection',
  127. 'uses' => 'MyController@collection',
  128. ]);
  129. $api->get('my/setting', [
  130. 'as' => 'my.setting',
  131. 'uses' => 'MyController@setting',
  132. ]);
  133. // 用户信息
  134. $api->get('user/show', [
  135. 'as' => 'user.show',
  136. 'uses' => 'HomeController@show',
  137. ]);
  138. // 见面
  139. $api->get('user/meet', [
  140. 'as' => 'user.meet',
  141. 'uses' => 'HomeController@meet',
  142. ]);
  143. // 梦想
  144. $api->get('dream/show', [
  145. 'as' => 'dream.show',
  146. 'uses' => 'DreamController@show',
  147. ]);
  148. $api->get('dream/search', [
  149. 'as' => 'dream.search',
  150. 'uses' => 'DreamController@search',
  151. ]);
  152. $api->get('dream/collection', [
  153. 'as' => 'dream.collection',
  154. 'uses' => 'DreamController@collection',
  155. ]);
  156. $api->post('dream/support', [
  157. 'as' => 'dream.support',
  158. 'uses' => 'DreamController@support',
  159. ]);
  160. $api->post('dream/store', [
  161. 'as' => 'dream.store',
  162. 'uses' => 'DreamController@store',
  163. ]);
  164. // interaction 动态
  165. $api->post('interaction/store', [
  166. 'as' => 'interaction.store',
  167. 'uses' => 'InteractionController@store',
  168. ]);
  169. $api->post('interaction/comment', [
  170. 'as' => 'interaction.comment',
  171. 'uses' => 'InteractionController@comment',
  172. ]);
  173. $api->post('interaction/reply', [
  174. 'as' => 'interaction.reply',
  175. 'uses' => 'InteractionController@reply',
  176. ]);
  177. });