admin.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  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::group(['namespace' => 'Base'], function () {
  28. //登录
  29. Route::post('/auth/login', 'AuthController@login');
  30. //上传文件
  31. Route::post('/common/upload', 'ResourceController@upload');
  32. //枚举
  33. Route::get('/common/enums', 'CommonController@enums');
  34. Route::group([
  35. 'middleware' => 'auth:admins'
  36. ], function () {
  37. Route::get('/auth/me', 'AuthController@me');
  38. Route::put('/auth/me', 'AuthController@update');
  39. Route::get('/auth/logout', 'AuthController@logout');
  40. Route::group(['prefix' => 'base'], function () {
  41. //部门管理
  42. Route::get('department', 'DepartmentController@index');
  43. Route::get('department/{id}', 'DepartmentController@show');
  44. Route::post('department', 'DepartmentController@store');
  45. Route::post('department/delete', 'DepartmentController@delete');
  46. Route::put('department/{id}', 'DepartmentController@update');
  47. Route::delete('department/{id}', 'DepartmentController@destroy');
  48. Route::get('department-tree', 'DepartmentController@tree');
  49. //管理员
  50. Route::get('/admin', 'AdminController@index');
  51. Route::get('admin/{id}', 'AdminController@show');
  52. Route::post('admin', 'AdminController@store');
  53. Route::put('admin/{id}', 'AdminController@update');
  54. Route::delete('admin/{id}', 'AdminController@destroy');
  55. //角色
  56. Route::get('/role', 'RoleController@index');
  57. Route::get('role/{id}', 'RoleController@show');
  58. Route::post('role', 'RoleController@store');
  59. Route::put('role/{id}', 'RoleController@update');
  60. Route::delete('role/{id}', 'RoleController@destroy');
  61. Route::get('role-lists', 'RoleController@lists');
  62. //菜单
  63. Route::get('/menu', 'MenuController@index');
  64. Route::get('/menu-icons', 'MenuController@icons');
  65. Route::get('menu/{id}', 'MenuController@show');
  66. Route::post('menu', 'MenuController@store');
  67. Route::put('menu/{id}', 'MenuController@update');
  68. Route::delete('menu/{id}', 'MenuController@destroy');
  69. Route::get('menu-tree', 'MenuController@tree');
  70. Route::get('menu-user', 'MenuController@menus');
  71. //轮播图管理
  72. Route::get('banner', 'BannersController@index');
  73. Route::get('banner/{id}', 'BannersController@show');
  74. Route::post('banner', 'BannersController@store');
  75. Route::post('banner/delete', 'BannersController@delete');
  76. Route::put('banner/{id}', 'BannersController@update');
  77. Route::delete('banner/{id}', 'BannersController@destroy');
  78. });
  79. });
  80. });
  81. //Route::get('course/info', 'Course\CourseController@index');
  82. Route::group([
  83. 'middleware' => 'auth:admins'
  84. ], function () {
  85. // 首页
  86. Route::get('/home', 'HomeController@index');
  87. //课程
  88. Route::group(['prefix' => 'course', 'namespace' => 'Course'], function () {
  89. //分类
  90. Route::get('category', 'CategoryController@index');
  91. Route::post('category', 'CategoryController@store');
  92. Route::get('category/{id}', 'CategoryController@show');
  93. Route::put('category/{id}', 'CategoryController@update');
  94. Route::delete('category/{id}', 'CategoryController@destroy');
  95. Route::post('category/delete', 'CategoryController@delete');
  96. Route::get('category-tree', 'CategoryController@tree');
  97. //课程
  98. Route::get('info', 'CourseController@index');
  99. Route::post('info', 'CourseController@store');
  100. Route::get('info/{id}', 'CourseController@show');
  101. Route::put('info/{id}', 'CourseController@update');
  102. Route::delete('info/{id}', 'CourseController@destroy');
  103. //章节
  104. Route::get('{course_id}/chapter', 'ChapterController@index');
  105. Route::post('{course_id}/chapter', 'ChapterController@store');
  106. Route::put('chapter/{id}', 'ChapterController@update');
  107. Route::delete('chapter/{id}', 'ChapterController@destroy');
  108. //视频
  109. Route::get('{course_id}/video', 'VideoController@index');
  110. Route::post('{course_id}/video', 'VideoController@store');
  111. Route::get('{course_id}/video/{id}', 'VideoController@show');
  112. Route::put('video/{id}', 'VideoController@update');
  113. Route::delete('video/{id}', 'VideoController@destroy');
  114. //附件
  115. Route::get('video/{course_video_id}/attach', 'AttachController@index');
  116. Route::post('video/{course_video_id}/attach', 'AttachController@store');
  117. Route::put('attach/{id}', 'AttachController@update');
  118. Route::delete('attach/{id}', 'AttachController@destroy');
  119. //班级
  120. Route::get('/organization', 'OrganizationsController@index');
  121. Route::get('/organization/info/{slug}', 'OrganizationsController@show');
  122. Route::post('/organization', 'OrganizationsController@store');
  123. Route::put('/organization/{id}', 'OrganizationsController@update');
  124. Route::delete('/organization/{id}', 'OrganizationsController@destroy');
  125. Route::post('/organization/courses', 'OrganizationsController@syncCourses');
  126. Route::get('/organization/students', 'OrganizationsController@students');
  127. Route::post('/organization/student', 'OrganizationsController@storeStudent');
  128. Route::post('/organization/student/update', 'OrganizationsController@updateStudent');
  129. Route::post('/organization/students/delete', 'OrganizationsController@destroyStudents');
  130. Route::get('/organization/statistical', 'OrganizationsController@statistical');
  131. });
  132. /**
  133. * 观看视频接口
  134. */
  135. Route::group(['prefix' => 'view', 'namespace' => 'Course'], function () {
  136. //分类
  137. Route::get('categories', 'CategoryController@lists');
  138. //视频列表
  139. Route::get('/courses', 'CourseController@lists');
  140. //视频详情
  141. Route::get('/course/{id}', 'CourseController@viewShow');
  142. //订阅
  143. Route::post('/course-subscribe', 'CourseController@subscribe');
  144. //评价
  145. Route::post('/comment', 'CommentController@store');
  146. //视频
  147. Route::get('/video/{id}', 'VideoController@viewShow');
  148. Route::post('/video-look-record', 'VideoController@lookRecord');
  149. Route::get('/attach-download/{id}', 'AttachController@download');
  150. Route::get('/video/{video_id}/comments', 'CommentController@videoComments');
  151. Route::get('/course/{course_id}/comments', 'CommentController@courseComments');
  152. });
  153. Route::group(['prefix' => 'inform', 'namespace' => 'Inform'], function () {
  154. //分类
  155. Route::get('category', 'CategoryController@index');
  156. Route::post('category', 'CategoryController@store');
  157. Route::get('category/{id}', 'CategoryController@show');
  158. Route::put('category/{id}', 'CategoryController@update');
  159. Route::delete('category/{id}', 'CategoryController@destroy');
  160. Route::post('category/delete', 'CategoryController@delete');
  161. Route::get('category-tree', 'CategoryController@tree');
  162. Route::get('category-user-tree', 'CategoryController@lists');
  163. //信息
  164. Route::get('information', 'InformationController@index');
  165. Route::post('information', 'InformationController@store');
  166. Route::get('information/{id}', 'InformationController@show');
  167. Route::put('information/{id}', 'InformationController@update');
  168. Route::delete('information/{id}', 'InformationController@destroy');
  169. Route::post('information/delete', 'InformationController@delete');
  170. Route::get('information-user-messages', 'InformationController@userMessages');
  171. Route::post('information-read-messages', 'InformationController@readMessages');
  172. Route::post('information-good', 'InformationController@good');
  173. });
  174. Route::group(['namespace' => 'Note', 'prefix' => 'note'], function () {
  175. Route::get('/', 'NotesController@index');
  176. Route::get('info/{slug}', 'NotesController@show');
  177. Route::get('comment', 'CommentsController@index');
  178. // Route::group([
  179. // 'middleware' => 'auth:admin'
  180. // ], function () {
  181. //笔记、问答
  182. Route::post('/', 'NotesController@store');
  183. Route::put('/{id}', 'NotesController@update');
  184. Route::delete('/{id}', 'NotesController@destroy');
  185. //点赞
  186. Route::post('good', 'NotesController@good');
  187. Route::post('comment', 'CommentsController@store');
  188. Route::delete('comment/{id}', 'CommentsController@destroy');
  189. Route::post('comment/good', 'CommentsController@good');
  190. Route::post('comment/answer', 'CommentsController@answer');
  191. // });
  192. });
  193. Route::group(['prefix' => 'user', 'namespace' => 'User'], function () {
  194. //分类
  195. // Route::get('student', 'StudentController@index');
  196. // Route::post('student', 'StudentController@store');
  197. // Route::get('student/{id}', 'StudentController@show');
  198. // Route::put('student/{id}', 'StudentController@update');
  199. // Route::delete('student/{id}', 'StudentController@destroy');
  200. // Route::post('student/delete', 'StudentController@delete');
  201. // Route::post('student-import', 'StudentController@import');
  202. // Route::post('student-export', 'StudentController@export');
  203. //用户管理
  204. Route::get('/', 'UserController@index');
  205. Route::post('/', 'UserController@store');
  206. Route::get('/{id}', 'UserController@show');
  207. Route::put('/{id}', 'UserController@update');
  208. Route::delete('/{id}', 'UserController@destroy');
  209. Route::post('/delete', 'UserController@delete');
  210. Route::post('/import', 'UserController@import');
  211. Route::post('/export', 'UserController@export');
  212. });
  213. /**
  214. * 试卷
  215. */
  216. Route::group(['namespace' => 'Exam', 'prefix' => 'exam'], function () {
  217. Route::get('/', 'PapersController@index');
  218. Route::get('/info/{slug}', 'PapersController@show');
  219. Route::get('/topic-select-options', 'TopicsController@selectOptions');
  220. // Route::post('/', 'PapersController@store');
  221. // Route::put('/{id}', 'PapersController@update');
  222. Route::delete('/{id}', 'PapersController@destroy');
  223. //批阅
  224. // Route::post('/examines', 'PapersController@examines');
  225. //试题
  226. Route::get('/topic', 'TopicsController@index');
  227. Route::get('/topic/{id}', 'TopicsController@show');
  228. // Route::post('/topic', 'TopicsController@store');
  229. // Route::put('/topic/{id}', 'TopicsController@update');
  230. Route::delete('/topic/{id}', 'TopicsController@destroy');
  231. //学生考试记录
  232. Route::delete('/result/{id}', 'PaperResultsController@destroy');
  233. Route::get('/result', 'PaperResultsController@index');
  234. Route::get('/result/{id}', 'PaperResultsController@show');
  235. Route::get('/result-analyse', 'PapersController@analyse');
  236. });
  237. // /**
  238. // * 中医处方分析
  239. // */
  240. // Route::group(['prefix' => 'tcm', 'namespace' => 'TCM'], function () {
  241. // //患者管理
  242. // Route::get('/patient', 'PatientController@index');
  243. // Route::get('/patient-lists', 'PatientController@lists');
  244. // Route::post('/patient', 'PatientController@store');
  245. // Route::get('/patient/{id}', 'PatientController@show');
  246. // Route::put('/patient/{id}', 'PatientController@update');
  247. // Route::delete('/patient/{id}', 'PatientController@destroy');
  248. // Route::post('/patient-export', 'PatientController@export');
  249. //
  250. // //分类
  251. // Route::get('/category', 'CategoryController@index');
  252. // Route::get('category-tree', 'CategoryController@tree');
  253. // Route::post('category', 'CategoryController@store');
  254. // Route::put('category/{id}', 'CategoryController@update');
  255. // Route::delete('category/{id}', 'CategoryController@destroy');
  256. //
  257. // //病历
  258. // Route::get('/medical-record', 'MedicalRecordController@index');
  259. // Route::post('/medical-record', 'MedicalRecordController@store');
  260. // Route::get('/medical-record/{id}', 'MedicalRecordController@show');
  261. // Route::put('/medical-record/{id}', 'MedicalRecordController@update');
  262. // Route::delete('/medical-record/{id}', 'MedicalRecordController@destroy');
  263. //
  264. // //处方
  265. // Route::get('/prescription', 'PrescriptionController@index');
  266. // Route::post('/prescription', 'PrescriptionController@store');
  267. // Route::get('/prescription/{id}', 'PrescriptionController@show');
  268. // Route::put('/prescription/{id}', 'PrescriptionController@update');
  269. // Route::delete('/prescription/{id}', 'PrescriptionController@destroy');
  270. // Route::get('/prescription-options', 'PrescriptionController@options');
  271. // Route::post('/prescription-import', 'PrescriptionController@import');
  272. //
  273. // //药物
  274. // Route::get('/drug', 'DrugController@index');
  275. // Route::post('/drug', 'DrugController@store');
  276. // Route::get('/drug/{id}', 'DrugController@show');
  277. // Route::put('/drug/{id}', 'DrugController@update');
  278. // Route::delete('/drug/{id}', 'DrugController@destroy');
  279. // Route::get('/drug-lists', 'DrugController@lists');
  280. // Route::post('/drug/delete', 'DrugController@delete');
  281. // Route::post('/drug-import', 'DrugController@import');
  282. //
  283. // //快速创建
  284. // Route::post('/quick-store', 'PrescriptionController@quickStore');
  285. // //分析
  286. // Route::get('/analyse', 'AnalyseController@index');
  287. // Route::get('/analyse-drug', 'AnalyseController@drug');
  288. // });
  289. //
  290. // Route::group(['prefix' => 'cms', 'namespace' => 'CMS'], function () {
  291. // //轮播图管理
  292. // Route::get('banner', 'BannersController@index');
  293. // Route::get('banner/{id}', 'BannersController@show');
  294. // Route::post('banner', 'BannersController@store');
  295. // Route::post('banner/delete', 'BannersController@delete');
  296. // Route::put('banner/{id}', 'BannersController@update');
  297. // Route::delete('banner/{id}', 'BannersController@destroy');
  298. //
  299. // //分类
  300. // Route::get('category', 'CategoriesController@index');
  301. // Route::post('category', 'CategoriesController@store');
  302. // Route::get('category/{id}', 'CategoriesController@show');
  303. // Route::put('category/{id}', 'CategoriesController@update');
  304. // Route::delete('category/{id}', 'CategoriesController@destroy');
  305. // Route::post('category/delete', 'CategoriesController@delete');
  306. // Route::get('category-tree', 'CategoriesController@tree');
  307. // Route::get('category-type', 'CategoriesController@type');
  308. //
  309. // //信息
  310. // Route::get('article', 'ArticlesController@index');
  311. // Route::post('article', 'ArticlesController@store');
  312. // Route::get('article/{id}', 'ArticlesController@show');
  313. // Route::put('article/{id}', 'ArticlesController@update');
  314. // Route::delete('article/{id}', 'ArticlesController@destroy');
  315. // Route::post('article/delete', 'ArticlesController@delete');
  316. //
  317. // //配置
  318. // Route::get('setting', 'SettingsController@index');
  319. // Route::post('setting', 'SettingsController@store');
  320. // Route::get('setting/{id}', 'SettingsController@show');
  321. // Route::put('setting/{id}', 'SettingsController@update');
  322. // Route::delete('setting/{id}', 'SettingsController@destroy');
  323. // Route::post('setting/delete', 'SettingsController@delete');
  324. // });
  325. });
  326. //附件下载
  327. //Route::get('/view/attach-download/{id}', 'Course\AttachController@download');
  328. Route::get('/', function () {
  329. return app()->version();
  330. });
  331. //开发环境接口
  332. Route::group(['prefix' => 'develop'], function () {
  333. //响应状态
  334. // Route::get('/http-status', 'DevelopController@httpStatus');
  335. Route::post('/t', 'ExampleController@test');
  336. Route::get('/init', 'ExampleController@init');
  337. });
  338. //
  339. //Route::get('author', function () {
  340. // $response = Http::withOptions(['timeout' => 3])->get('https://api.github.com/users/Jiannei');
  341. // $response->throw();
  342. //
  343. // return Response::success($response->json());
  344. //});
  345. //
  346. //// 测试路由
  347. //Route::group(['prefix' => 'test'], function () {
  348. // Route::get('configurations', 'ExampleController@configurations');
  349. // Route::get('logs', ['uses' => 'ExampleController@logs', 'middleware' => 'throttle:5,1']);
  350. // Route::put('roles', 'ExampleController@syncRoles');
  351. // Route::put('permissions', 'ExampleController@syncPermissions');
  352. //
  353. // Route::get('posts', 'PostsController@index');
  354. //});
  355. //
  356. //// 用户管理
  357. //Route::post('users', 'UsersController@store');
  358. //Route::get('users/{id}', 'UsersController@show');
  359. //Route::get('users', 'UsersController@index');
  360. //Route::get('users/pagination/simple', 'UsersController@simple');
  361. //Route::get('users/pagination/cursor', 'UsersController@cursor');
  362. //
  363. //// 授权管理
  364. //Route::post('authorization', 'AuthorizationController@store');
  365. //Route::delete('authorization', 'AuthorizationController@destroy');
  366. //Route::put('authorization', 'AuthorizationController@update');
  367. //Route::get('authorization', 'AuthorizationController@show');