api.php 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <?php
  2. use Illuminate\Http\Request;
  3. use Illuminate\Support\Facades\Route;
  4. use App\Http\Controllers\LoginController;
  5. use App\Http\Controllers\ArticleController;
  6. /*
  7. |--------------------------------------------------------------------------
  8. | API Routes
  9. |--------------------------------------------------------------------------
  10. |
  11. | Here is where you can register API routes for your application. These
  12. | routes are loaded by the RouteServiceProvider within a group which
  13. | is assigned the "api" middleware group. Enjoy building your API!
  14. |
  15. */
  16. //
  17. //Route::middleware('auth:api')->get('/user', function (Request $request) {
  18. // return $request->user();
  19. //});
  20. $api = app('Dingo\Api\Routing\Router');
  21. //这里的version是版本,里面的v1是在env里面定义好的。
  22. $api->version('v1', function($api) {
  23. $api->get('gzh', function(){
  24. return view('gzh');
  25. // return 'this is test dingo api';
  26. });
  27. $api->get('dist', function(){
  28. return view('dist');
  29. });
  30. // $api->group(['prefix'=>'login'], function ($api) {
  31. // $api->post('login', [LoginController::class,'login'])->name('login');
  32. // $api->post('register', [LoginController::class,'register']);
  33. // $api->group(['middleware' => 'auth:users'],function($api){
  34. // $api->get('logout', [LoginController::class,'logout']);
  35. // $api->get('user', [LoginController::class,'getAuthUser']);
  36. // });
  37. // });
  38. //
  39. // $api->group(['prefix'=>'article'], function ($api) {
  40. // $api->get('list', [ArticleController::class,'list']);
  41. // $api->get('detail', [ArticleController::class,'detail']);
  42. // $api->group(['middleware' => 'auth:users'],function($api){
  43. //// $api->group(['middleware' => 'check_token'],function($api){
  44. // $api->get('getDataInfo', [ArticleController::class,'getDataInfo']);
  45. // $api->post('like', [ArticleController::class,'like']);
  46. // $api->post('share', [ArticleController::class,'share']);
  47. // $api->post('read', [ArticleController::class,'read']);
  48. // $api->post('addComment', [ArticleController::class,'addComment']);
  49. // $api->get('getSignPackage', [ArticleController::class,'getSignPackage']);
  50. // $api->get('getArticleLike', [ArticleController::class,'getArticleLike']);
  51. // $api->get('getWetalkData', [ArticleController::class,'getWetalkData']);
  52. // $api->get('getAllWetalkComment', [ArticleController::class,'getAllWetalkComment']);
  53. // });
  54. // });
  55. $api->group(['prefix'=>'admin','namespace'=>'App\Http\Controllers\Admin'], function($api){
  56. $api->post('login','LoginController@login')->name('login');
  57. $api->post('register','LoginController@register');
  58. $api->post('refresh', 'LoginController@refresh')->name('refresh');
  59. $api->group(['middleware' => ['check_token','auth:admins']],function($api) {
  60. $api->get('getAuthUserT', 'LoginController@getAuthUser');
  61. });
  62. $api->group(['middleware' => ['check_token','auth:admins']],function($api) {
  63. $api->get('getAuthUser', 'LoginController@getAuthUser');
  64. $api->get('list', 'LoginController@list');
  65. $api->post('delete', 'LoginController@delete');
  66. $api->post('edit', 'LoginController@edit');
  67. $api->post('logout', 'LoginController@logout');
  68. });
  69. $api->group(['prefix'=>'article'], function ($api) {
  70. $api->get('list', 'ArtController@list');
  71. $api->get('detail', 'ArtController@detail');
  72. $api->get('downAudioFile', 'ArtController@downAudioFile');
  73. $api->group(['middleware' => ['check_token','auth:admins']],function($api){//'check_token'
  74. $api->post('uploadAudio', 'ArtController@uploadAudio');
  75. $api->post('uploadAudioSimple', 'ArtController@uploadAudioSimple');
  76. $api->post('continueUploadAudio', 'ArtController@continueUploadAudio');
  77. $api->post('editArticle', 'ArtController@editArticle');
  78. $api->post('editArticleContent', 'ArtController@editArticleContent');
  79. $api->get('getArticleListNum', 'ArtController@getArticleListNum');
  80. $api->get('getArticleList', 'ArtController@getArticleList');
  81. $api->get('getArticleDetail', 'ArtController@getArticleDetail');
  82. $api->post('uploadImg', 'ArtController@uploadImg');
  83. $api->post('deleteArticle', 'ArtController@deleteArticle');
  84. $api->post('manualRelease', 'ArtController@manualRelease');
  85. $api->post('cancelShelvesArticle', 'ArtController@cancelShelvesArticle');
  86. $api->get('getCommentList', 'ArtController@getCommentList');
  87. $api->post('authComment', 'ArtController@authComment');
  88. $api->get('getArticleComment', 'ArtController@getArticleComment');
  89. $api->post('uploadBackgroundMusic', 'ArtController@uploadBackgroundMusic');
  90. $api->post('addBackgroundMusic', 'ArtController@addBackgroundMusic');
  91. $api->post('editBackgroundMusic', 'ArtController@editBackgroundMusic');
  92. // $api->get('sendSms', 'ArtController@sendSms');
  93. $api->get('getAllPhone', 'ArtController@getAllPhone');
  94. $api->post('addPhone', 'ArtController@addPhone');
  95. $api->post('deletePhone', 'ArtController@deletePhone');
  96. $api->get('getData', 'ArtController@getData');
  97. $api->get('ddd', 'ArtController@ddd');
  98. });
  99. });
  100. $api->group(['prefix'=>'data'], function ($api) {
  101. $api->group(['middleware' => ['check_token','auth:admins']],function($api){
  102. $api->get('index', 'DataController@index');
  103. $api->get('getArticleRead', 'DataController@getArticleRead');
  104. });
  105. });
  106. //不验证token
  107. $api->group(['prefix' => 'check'],function($api) {
  108. $api->post('login','LoginController@login')->name('login');
  109. $api->post('register','LoginController@register');
  110. $api->post('refresh', 'LoginController@refresh')->name('refresh');
  111. $api->get('getAuthUserT', 'LoginController@getAuthUser');
  112. $api->get('getAuthUser', 'LoginController@getAuthUser');
  113. $api->get('list', 'LoginController@list');
  114. $api->post('delete', 'LoginController@delete');
  115. $api->post('edit', 'LoginController@edit');
  116. $api->post('logout', 'LoginController@logout');
  117. $api->group(['prefix' => 'article'], function ($api) {
  118. $api->get('list', 'ArtController@list');
  119. $api->get('detail', 'ArtController@detail');
  120. $api->post('uploadAudio', 'ArtController@uploadAudio');
  121. $api->post('uploadAudioSimple', 'ArtController@uploadAudioSimple');
  122. $api->post('continueUploadAudio', 'ArtController@continueUploadAudio');
  123. $api->post('editArticle', 'ArtController@editArticle');
  124. $api->post('editArticleContent', 'ArtController@editArticleContent');
  125. $api->get('getArticleListNum', 'ArtController@getArticleListNum');
  126. $api->get('getArticleList', 'ArtController@getArticleList');
  127. $api->get('getArticleDetail', 'ArtController@getArticleDetail');
  128. $api->post('uploadImg', 'ArtController@uploadImg');
  129. $api->post('deleteArticle', 'ArtController@deleteArticle');
  130. $api->post('manualRelease', 'ArtController@manualRelease');
  131. $api->post('cancelShelvesArticle', 'ArtController@cancelShelvesArticle');
  132. $api->get('getCommentList', 'ArtController@getCommentList');
  133. $api->post('authComment', 'ArtController@authComment');
  134. $api->get('getArticleComment', 'ArtController@getArticleComment');
  135. $api->post('uploadBackgroundMusic', 'ArtController@uploadBackgroundMusic');
  136. $api->post('addBackgroundMusic', 'ArtController@addBackgroundMusic');
  137. $api->post('editBackgroundMusic', 'ArtController@editBackgroundMusic');
  138. // $api->get('sendSms', 'ArtController@sendSms');
  139. $api->get('getAllPhone', 'ArtController@getAllPhone');
  140. $api->post('addPhone', 'ArtController@addPhone');
  141. $api->post('deletePhone', 'ArtController@deletePhone');
  142. $api->get('getData', 'ArtController@getData');
  143. $api->get('ddd', 'ArtController@ddd');
  144. });
  145. $api->group(['prefix' => 'data'], function ($api) {
  146. $api->get('index', 'DataController@index');
  147. $api->get('getArticleRead', 'DataController@getArticleRead');
  148. });
  149. });
  150. });
  151. });