web.php 11 KB

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