web.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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::group(['namespace' => 'CMS'], function () {
  27. //上传文件
  28. Route::post('/common/upload', 'ResourceController@upload');
  29. //banner
  30. Route::get('/banner', 'BannersController@index');
  31. //导航
  32. Route::get('/category', 'CategoriesController@index');
  33. //文章
  34. Route::get('/articles', 'ArticlesController@index');
  35. Route::get('/article', 'ArticlesController@article');
  36. Route::get('/article-lists', 'ArticlesController@lists');
  37. Route::get('/article/{id}', 'ArticlesController@show');
  38. //配置
  39. Route::get('/settings', 'SettingController@index');
  40. //登录
  41. // Route::post('/auth/login', 'AuthController@login');
  42. // Route::post('/auth/register', 'AuthController@store');
  43. // Route::group([
  44. // 'middleware' => 'auth:api'
  45. // ], function () {
  46. // Route::get('/auth/me', 'AuthController@me');
  47. // Route::put('/auth/me', 'AuthController@update');
  48. // Route::get('/auth/logout', 'AuthController@logout');
  49. // });
  50. });
  51. /**
  52. * 观看视频接口
  53. */
  54. Route::group(['namespace' => 'Course'], function () {
  55. //分类
  56. Route::get('/course/categories', 'CategoryController@index');
  57. //视频列表
  58. Route::get('/courses', 'CourseController@index');
  59. //视频详情
  60. Route::get('/course', 'CourseController@show');
  61. Route::group([
  62. 'prefix' => 'course',
  63. // 'middleware' => 'auth:api'
  64. ], function () {
  65. //订阅
  66. Route::post('/course-subscribe', 'CourseController@subscribe');
  67. //观看记录
  68. Route::get('/course-look', 'CourseController@lookCourses');
  69. //评价
  70. Route::post('/comment', 'CommentController@store');
  71. //视频
  72. Route::get('/video/{id}', 'VideoController@viewShow');
  73. Route::post('/video-look-record', 'VideoController@lookRecord');
  74. Route::get('/attach-download/{id}', 'AttachController@download');
  75. Route::get('/video/{video_id}/comments', 'CommentController@videoComments');
  76. Route::get('/course/{course_id}/comments', 'CommentController@courseComments');
  77. });
  78. });
  79. //笔记
  80. Route::group(['namespace' => 'Note', 'prefix' => 'note'], function () {
  81. Route::get('index', 'NotesController@index');
  82. Route::get('show/{id}', 'NotesController@show');
  83. Route::get('comment', 'CommentsController@index');
  84. Route::group([
  85. 'middleware' => 'auth:api'
  86. ], function () {
  87. Route::post('store', 'NotesController@store');
  88. Route::put('update/{id}', 'NotesController@update');
  89. Route::delete('delete/{id}', 'NotesController@destroy');
  90. Route::post('good', 'NotesController@good');
  91. Route::post('comment', 'CommentsController@store');
  92. Route::delete('comment/{id}', 'CommentsController@destroy');
  93. Route::post('comment/good', 'CommentsController@good');
  94. Route::post('comment/answer', 'CommentsController@answer');
  95. });
  96. });
  97. //Route::group(['prefix' => 'inform', 'namespace' => 'Inform'], function () {
  98. // //分类
  99. // Route::get('category', 'CategoryController@index');
  100. // Route::post('category', 'CategoryController@store');
  101. // Route::get('category/{id}', 'CategoryController@show');
  102. // Route::put('category/{id}', 'CategoryController@update');
  103. // Route::delete('category/{id}', 'CategoryController@destroy');
  104. // Route::post('category/delete', 'CategoryController@delete');
  105. // Route::get('category-tree', 'CategoryController@tree');
  106. // Route::get('category-user-tree', 'CategoryController@lists');
  107. //
  108. // //信息
  109. // Route::get('information', 'InformationController@index');
  110. // Route::post('information', 'InformationController@store');
  111. // Route::get('information/{id}', 'InformationController@show');
  112. // Route::put('information/{id}', 'InformationController@update');
  113. // Route::delete('information/{id}', 'InformationController@destroy');
  114. // Route::post('information/delete', 'InformationController@delete');
  115. // Route::get('information-user-messages', 'InformationController@userMessages');
  116. // Route::post('information-read-messages', 'InformationController@readMessages');
  117. // Route::post('information-good', 'InformationController@good');
  118. //});
  119. Route::get('/', function () {
  120. return Response::success(app()->version());
  121. });
  122. //开发环境接口
  123. Route::group(['prefix' => 'develop'], function () {
  124. //响应状态
  125. // Route::get('/http-status', 'DevelopController@httpStatus');
  126. Route::post('/t', 'ExampleController@test');
  127. Route::get('/init', 'ExampleController@init');
  128. });