web.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  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' => 'Base', 'prefix' => 'base'], function () {
  27. //登录
  28. Route::post('/auth/login', 'AuthController@login');
  29. //上传文件
  30. Route::post('/common/upload', 'ResourceController@upload');
  31. //枚举
  32. Route::get('/common/enums', 'CommonController@enums');
  33. Route::group([
  34. 'middleware' => ['auth:api']
  35. ], function () {
  36. Route::get('/auth/me', 'AuthController@me');
  37. Route::put('/auth/me', 'AuthController@update');
  38. Route::put('/auth/password', 'AuthController@changePassword');
  39. Route::get('/auth/logout', 'AuthController@logout');
  40. });
  41. });
  42. //Route::get('/page/home', 'PageController@home');
  43. //Route::get('/page/navigations', 'PageController@navigations');
  44. //Route::get('/page/articles', 'PageController@articles');
  45. //Route::get('/page/article/{id}', 'PageController@article');
  46. //Route::get('/page/navigation-article/{id}', 'PageController@navigationArticle');
  47. //Route::post('/page/settings', 'PageController@settings');
  48. Route::group(['namespace' => 'CMS'], function () {
  49. //上传文件
  50. Route::post('/common/upload', 'ResourceController@upload');
  51. //banner
  52. Route::get('/banner', 'BannersController@index');
  53. //导航
  54. Route::get('/category', 'CategoriesController@index');
  55. //文章
  56. Route::get('/articles', 'ArticlesController@index');
  57. Route::get('/article', 'ArticlesController@article');
  58. Route::get('/article-lists', 'ArticlesController@lists');
  59. Route::get('/article/{id}', 'ArticlesController@show');
  60. //配置
  61. Route::get('/settings', 'SettingController@index');
  62. //登录
  63. // Route::post('/auth/login', 'AuthController@login');
  64. // Route::post('/auth/register', 'AuthController@store');
  65. // Route::group([
  66. // 'middleware' => 'auth:api'
  67. // ], function () {
  68. // Route::get('/auth/me', 'AuthController@me');
  69. // Route::put('/auth/me', 'AuthController@update');
  70. // Route::get('/auth/logout', 'AuthController@logout');
  71. // });
  72. });
  73. //用户管理
  74. Route::group(['namespace' => 'User', 'prefix' => 'user'], function () {
  75. Route::get('/', 'UserController@index');
  76. // Route::post('/', 'UserController@store');
  77. // Route::get('/{id}', 'UserController@show');
  78. // Route::put('/{id}', 'UserController@update');
  79. // Route::delete('/{id}', 'UserController@destroy');
  80. // Route::post('/delete', 'UserController@delete');
  81. // Route::post('/import', 'UserController@import');
  82. // Route::post('/export', 'UserController@export');
  83. });
  84. /**
  85. * 视频接口
  86. */
  87. Route::group(['namespace' => 'Course', 'prefix' => 'course'], function () {
  88. //分类
  89. Route::get('/categories', 'CategoryController@index');
  90. //视频列表
  91. Route::get('/', 'CourseController@index');
  92. Route::get('/random', 'CourseController@random');
  93. Route::get('/select-options', 'CourseController@selectOptions');
  94. //视频详情
  95. Route::get('/info/{slug}', 'CourseController@show');
  96. Route::group([
  97. 'middleware' => 'auth:api'
  98. ], function () {
  99. Route::group([
  100. 'middleware' => 'auth.role:teacher'
  101. ], function () {
  102. //老师路由
  103. Route::post('/', 'CourseController@store');
  104. Route::put('/{id}', 'CourseController@update');
  105. Route::delete('/{id}', 'CourseController@destroy');
  106. //章节
  107. Route::post('/chapter', 'ChapterController@store');
  108. Route::put('/chapter/{id}', 'ChapterController@update');
  109. Route::delete('/chapter/{id}', 'ChapterController@destroy');
  110. //视频
  111. Route::post('/video', 'VideoController@store');
  112. Route::put('video/{id}', 'VideoController@update');
  113. Route::delete('video/{id}', 'VideoController@destroy');
  114. //附件
  115. Route::post('/attach', 'AttachController@store');
  116. Route::put('/attach/{id}', 'AttachController@update');
  117. Route::delete('/attach/{id}', 'AttachController@destroy');
  118. //班级
  119. Route::post('/organization', 'OrganizationsController@store');
  120. Route::put('/organization/{id}', 'OrganizationsController@update');
  121. Route::delete('/organization/{id}', 'OrganizationsController@destroy');
  122. Route::post('/organization/courses', 'OrganizationsController@syncCourses');
  123. Route::post('/organization/student/update', 'OrganizationsController@updateStudent');
  124. Route::post('/organization/students/delete', 'OrganizationsController@destroyStudents');
  125. Route::get('/organization/statistical', 'OrganizationsController@statistical');
  126. });
  127. //班级
  128. Route::get('/organization', 'OrganizationsController@index');
  129. Route::get('/organization/info/{slug}', 'OrganizationsController@show');
  130. Route::get('/organization/teacher', 'OrganizationsController@teacher');
  131. Route::get('/organization/students', 'OrganizationsController@students');
  132. Route::post('/organization/student', 'OrganizationsController@storeStudent');
  133. //课程详情【学生】
  134. Route::get('/detail/{slug}', 'CourseController@detail');
  135. //订阅
  136. Route::post('/subscribe', 'CourseController@subscribe');
  137. //章节列表
  138. Route::get('/chapter', 'ChapterController@index');
  139. //视频
  140. Route::get('/video', 'VideoController@index');
  141. Route::get('/video/select-options', 'VideoController@selectOptions');
  142. Route::get('/video/info/{slug}', 'VideoController@show');
  143. Route::post('/video/look-record', 'VideoController@lookRecord');
  144. // 学生
  145. Route::get('/video/detail/{slug}', 'VideoController@detail');
  146. //附件
  147. Route::get('/attach', 'AttachController@index');
  148. Route::get('/attach/download/{slug}', 'AttachController@download');
  149. //观看记录
  150. Route::get('/course-look', 'CourseController@lookCourses');
  151. //评价
  152. Route::post('/comment', 'CommentController@store');
  153. Route::get('/comments', 'CommentController@index');
  154. //收藏
  155. Route::post('/collection', 'CourseController@collection');
  156. });
  157. });
  158. /**
  159. * 试卷
  160. */
  161. Route::group(['namespace' => 'Exam', 'prefix' => 'exam', 'middleware' => 'auth:api'], function () {
  162. Route::get('/', 'PapersController@index');
  163. Route::get('/info/{slug}', 'PapersController@show');
  164. Route::get('/topic-select-options', 'TopicsController@selectOptions');
  165. //提交考试结果
  166. Route::post('/examination', 'PapersController@examination');
  167. // Route::get('/', 'TopicsController@index');
  168. Route::group([
  169. 'middleware' => 'auth.role:teacher'
  170. ], function () {
  171. Route::post('/', 'PapersController@store');
  172. Route::put('/{id}', 'PapersController@update');
  173. Route::delete('/{id}', 'PapersController@destroy');
  174. //批阅
  175. Route::post('/examines', 'PapersController@examines');
  176. //试题
  177. Route::get('/topic', 'TopicsController@index');
  178. Route::get('/topic/{id}', 'TopicsController@show');
  179. Route::post('/topic', 'TopicsController@store');
  180. Route::put('/topic/{id}', 'TopicsController@update');
  181. Route::delete('/topic/{id}', 'TopicsController@destroy');
  182. //学生考试记录
  183. Route::delete('/result/{id}', 'PaperResultsController@destroy');
  184. });
  185. Route::get('/result', 'PaperResultsController@index');
  186. Route::get('/result/{id}', 'PaperResultsController@show');
  187. });
  188. //笔记
  189. Route::group(['namespace' => 'Note', 'prefix' => 'note'], function () {
  190. Route::get('/', 'NotesController@index');
  191. Route::get('info/{slug}', 'NotesController@show');
  192. Route::get('comment', 'CommentsController@index');
  193. Route::group([
  194. 'middleware' => 'auth:api'
  195. ], function () {
  196. //笔记、问答
  197. Route::post('/', 'NotesController@store');
  198. Route::put('/{id}', 'NotesController@update');
  199. Route::delete('/{id}', 'NotesController@destroy');
  200. //点赞
  201. Route::post('good', 'NotesController@good');
  202. Route::post('comment', 'CommentsController@store');
  203. Route::delete('comment/{id}', 'CommentsController@destroy');
  204. Route::post('comment/good', 'CommentsController@good');
  205. Route::post('comment/answer', 'CommentsController@answer');
  206. });
  207. });
  208. Route::group(['prefix' => 'inform', 'namespace' => 'Inform'], function () {
  209. //分类
  210. // Route::get('category', 'CategoryController@index');
  211. // Route::post('category', 'CategoryController@store');
  212. // Route::get('category/{id}', 'CategoryController@show');
  213. // Route::put('category/{id}', 'CategoryController@update');
  214. // Route::delete('category/{id}', 'CategoryController@destroy');
  215. // Route::post('category/delete', 'CategoryController@delete');
  216. // Route::get('category-tree', 'CategoryController@tree');
  217. // Route::get('category-user-tree', 'CategoryController@lists');
  218. //信息
  219. Route::group([
  220. 'middleware' => 'auth.role:teacher'
  221. ], function () {
  222. Route::post('/', 'InformationController@store');
  223. Route::delete('/{id}', 'InformationController@destroy');
  224. });
  225. Route::get('/', 'InformationController@index');
  226. Route::get('/info/{slug}', 'InformationController@show');
  227. Route::post('/good', 'InformationController@good');
  228. // Route::put('information/{id}', 'InformationController@update');
  229. // Route::post('information/delete', 'InformationController@delete');
  230. // Route::get('information-user-messages', 'InformationController@userMessages');
  231. // Route::post('information-read-messages', 'InformationController@readMessages');
  232. });
  233. Route::get('/', function () {
  234. return Response::success(app()->version());
  235. });
  236. //开发环境接口
  237. Route::group(['prefix' => 'develop'], function () {
  238. //响应状态
  239. // Route::get('/http-status', 'DevelopController@httpStatus');
  240. Route::get('/t', 'ExampleController@test');
  241. Route::get('/init', 'ExampleController@init');
  242. });