web.php 4.9 KB

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