web.php 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <?php
  2. /*
  3. * This file is part of the Jiannei/lumen-api-starter.
  4. *
  5. * (c) Jiannei <longjian.huang@foxmail.com>
  6. *
  7. * This source file is subject to the MIT license that is bundled
  8. * with this source code in the file LICENSE.
  9. */
  10. use Illuminate\Support\Facades\Route;
  11. use Jiannei\Response\Laravel\Support\Facades\Response;
  12. /*
  13. |--------------------------------------------------------------------------
  14. | Application Routes
  15. |--------------------------------------------------------------------------
  16. |
  17. | Here is where you can register all of the routes for an application.
  18. | It is a breeze. Simply tell Lumen the URIs it should respond to
  19. | and give it the Closure to call when that URI is requested.
  20. |
  21. */
  22. /**
  23. * 基础业务模块
  24. */
  25. Route::get('/home', 'HomeController@index');
  26. Route::get('/page/home', 'PageController@home');
  27. Route::get('/page/navigations', 'PageController@navigations');
  28. Route::get('/page/articles', 'PageController@articles');
  29. Route::get('/page/article/{id}', 'PageController@article');
  30. Route::get('/page/navigation-article/{id}', 'PageController@navigationArticle');
  31. Route::post('/page/settings', 'PageController@settings');
  32. Route::group(['namespace' => 'CMS'], function () {
  33. //上传文件
  34. Route::post('/common/upload', 'ResourceController@upload');
  35. //banner
  36. Route::get('/banner', 'BannersController@index');
  37. //导航
  38. Route::get('/category', 'CategoriesController@index');
  39. //文章
  40. Route::get('/articles', 'ArticlesController@index');
  41. Route::get('/article', 'ArticlesController@article');
  42. Route::get('/article-lists', 'ArticlesController@lists');
  43. Route::get('/article/{id}', 'ArticlesController@show');
  44. //配置
  45. Route::get('/settings', 'SettingController@index');
  46. //登录
  47. // Route::post('/auth/login', 'AuthController@login');
  48. // Route::post('/auth/register', 'AuthController@store');
  49. // Route::group([
  50. // 'middleware' => 'auth:api'
  51. // ], function () {
  52. // Route::get('/auth/me', 'AuthController@me');
  53. // Route::put('/auth/me', 'AuthController@update');
  54. // Route::get('/auth/logout', 'AuthController@logout');
  55. // });
  56. });
  57. /**
  58. * 观看视频接口
  59. */
  60. Route::group(['namespace' => 'Course'], function () {
  61. //分类
  62. Route::get('/course/categories', 'CategoryController@index');
  63. //视频列表
  64. Route::get('/courses', 'CourseController@index');
  65. //视频详情
  66. Route::get('/course', 'CourseController@show');
  67. Route::group([
  68. 'prefix' => 'course',
  69. // 'middleware' => 'auth:api'
  70. ], function () {
  71. //订阅
  72. Route::post('/course-subscribe', 'CourseController@subscribe');
  73. //观看记录
  74. Route::get('/course-look', 'CourseController@lookCourses');
  75. //评价
  76. Route::post('/comment', 'CommentController@store');
  77. //视频
  78. Route::get('/video/{id}', 'VideoController@viewShow');
  79. Route::post('/video-look-record', 'VideoController@lookRecord');
  80. Route::get('/attach-download/{id}', 'AttachController@download');
  81. Route::get('/video/{video_id}/comments', 'CommentController@videoComments');
  82. Route::get('/course/{course_id}/comments', 'CommentController@courseComments');
  83. });
  84. });
  85. //笔记
  86. Route::group(['namespace' => 'Note', 'prefix' => 'note'], function () {
  87. Route::get('index', 'NotesController@index');
  88. Route::get('show/{id}', 'NotesController@show');
  89. Route::get('comment', 'CommentsController@index');
  90. Route::group([
  91. 'middleware' => 'auth:api'
  92. ], function () {
  93. Route::post('store', 'NotesController@store');
  94. Route::put('update/{id}', 'NotesController@update');
  95. Route::delete('delete/{id}', 'NotesController@destroy');
  96. Route::post('good', 'NotesController@good');
  97. Route::post('comment', 'CommentsController@store');
  98. Route::delete('comment/{id}', 'CommentsController@destroy');
  99. Route::post('comment/good', 'CommentsController@good');
  100. Route::post('comment/answer', 'CommentsController@answer');
  101. });
  102. });
  103. //Route::group(['prefix' => 'inform', 'namespace' => 'Inform'], function () {
  104. // //分类
  105. // Route::get('category', 'CategoryController@index');
  106. // Route::post('category', 'CategoryController@store');
  107. // Route::get('category/{id}', 'CategoryController@show');
  108. // Route::put('category/{id}', 'CategoryController@update');
  109. // Route::delete('category/{id}', 'CategoryController@destroy');
  110. // Route::post('category/delete', 'CategoryController@delete');
  111. // Route::get('category-tree', 'CategoryController@tree');
  112. // Route::get('category-user-tree', 'CategoryController@lists');
  113. //
  114. // //信息
  115. // Route::get('information', 'InformationController@index');
  116. // Route::post('information', 'InformationController@store');
  117. // Route::get('information/{id}', 'InformationController@show');
  118. // Route::put('information/{id}', 'InformationController@update');
  119. // Route::delete('information/{id}', 'InformationController@destroy');
  120. // Route::post('information/delete', 'InformationController@delete');
  121. // Route::get('information-user-messages', 'InformationController@userMessages');
  122. // Route::post('information-read-messages', 'InformationController@readMessages');
  123. // Route::post('information-good', 'InformationController@good');
  124. //});
  125. Route::get('/', function () {
  126. return Response::success(app()->version());
  127. });
  128. //开发环境接口
  129. Route::group(['prefix' => 'develop'], function () {
  130. //响应状态
  131. // Route::get('/http-status', 'DevelopController@httpStatus');
  132. Route::get('/t', 'ExampleController@test');
  133. Route::get('/init', 'ExampleController@init');
  134. });