admin.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  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::group([
  82. 'middleware' => 'auth:admins'
  83. ], function () {
  84. // 首页
  85. Route::get('/home', 'HomeController@index');
  86. //课程
  87. Route::group(['prefix' => 'course', 'namespace' => 'Course'], function () {
  88. //分类
  89. Route::get('category', 'CategoryController@index');
  90. Route::post('category', 'CategoryController@store');
  91. Route::get('category/{id}', 'CategoryController@show');
  92. Route::put('category/{id}', 'CategoryController@update');
  93. Route::delete('category/{id}', 'CategoryController@destroy');
  94. Route::post('category/delete', 'CategoryController@delete');
  95. Route::get('category-tree', 'CategoryController@tree');
  96. //课程
  97. Route::get('info', 'CourseController@index');
  98. Route::post('info', 'CourseController@store');
  99. Route::get('info/{id}', 'CourseController@show');
  100. Route::put('info/{id}', 'CourseController@update');
  101. Route::delete('info/{id}', 'CourseController@destroy');
  102. //章节
  103. Route::get('{course_id}/chapter', 'ChapterController@index');
  104. Route::post('{course_id}/chapter', 'ChapterController@store');
  105. Route::put('chapter/{id}', 'ChapterController@update');
  106. Route::delete('chapter/{id}', 'ChapterController@destroy');
  107. //视频
  108. Route::get('{course_id}/video', 'VideoController@index');
  109. Route::post('{course_id}/video', 'VideoController@store');
  110. Route::get('{course_id}/video/{id}', 'VideoController@show');
  111. Route::put('video/{id}', 'VideoController@update');
  112. Route::delete('video/{id}', 'VideoController@destroy');
  113. //附件
  114. Route::get('video/{course_video_id}/attach', 'AttachController@index');
  115. Route::post('video/{course_video_id}/attach', 'AttachController@store');
  116. Route::put('attach/{id}', 'AttachController@update');
  117. Route::delete('attach/{id}', 'AttachController@destroy');
  118. });
  119. /**
  120. * 观看视频接口
  121. */
  122. Route::group(['prefix' => 'view', 'namespace' => 'Course'], function () {
  123. //分类
  124. Route::get('categories', 'CategoryController@lists');
  125. //视频列表
  126. Route::get('/courses', 'CourseController@lists');
  127. //视频详情
  128. Route::get('/course/{id}', 'CourseController@viewShow');
  129. //订阅
  130. Route::post('/course-subscribe', 'CourseController@subscribe');
  131. //评价
  132. Route::post('/comment', 'CommentController@store');
  133. //视频
  134. Route::get('/video/{id}', 'VideoController@viewShow');
  135. Route::post('/video-look-record', 'VideoController@lookRecord');
  136. Route::get('/attach-download/{id}', 'AttachController@download');
  137. Route::get('/video/{video_id}/comments', 'CommentController@videoComments');
  138. Route::get('/course/{course_id}/comments', 'CommentController@courseComments');
  139. });
  140. Route::group(['prefix' => 'inform', 'namespace' => 'Inform'], function () {
  141. //分类
  142. Route::get('category', 'CategoryController@index');
  143. Route::post('category', 'CategoryController@store');
  144. Route::get('category/{id}', 'CategoryController@show');
  145. Route::put('category/{id}', 'CategoryController@update');
  146. Route::delete('category/{id}', 'CategoryController@destroy');
  147. Route::post('category/delete', 'CategoryController@delete');
  148. Route::get('category-tree', 'CategoryController@tree');
  149. Route::get('category-user-tree', 'CategoryController@lists');
  150. //信息
  151. Route::get('information', 'InformationController@index');
  152. Route::post('information', 'InformationController@store');
  153. Route::get('information/{id}', 'InformationController@show');
  154. Route::put('information/{id}', 'InformationController@update');
  155. Route::delete('information/{id}', 'InformationController@destroy');
  156. Route::post('information/delete', 'InformationController@delete');
  157. Route::get('information-user-messages', 'InformationController@userMessages');
  158. Route::post('information-read-messages', 'InformationController@readMessages');
  159. Route::post('information-good', 'InformationController@good');
  160. });
  161. Route::group(['prefix' => 'user', 'namespace' => 'User'], function () {
  162. //分类
  163. Route::get('student', 'StudentController@index');
  164. Route::post('student', 'StudentController@store');
  165. Route::get('student/{id}', 'StudentController@show');
  166. Route::put('student/{id}', 'StudentController@update');
  167. Route::delete('student/{id}', 'StudentController@destroy');
  168. Route::post('student/delete', 'StudentController@delete');
  169. Route::post('student-import', 'StudentController@import');
  170. Route::post('student-export', 'StudentController@export');
  171. });
  172. /**
  173. * 中医处方分析
  174. */
  175. Route::group(['prefix' => 'tcm', 'namespace' => 'TCM'], function () {
  176. //患者管理
  177. Route::get('/patient', 'PatientController@index');
  178. Route::get('/patient-lists', 'PatientController@lists');
  179. Route::post('/patient', 'PatientController@store');
  180. Route::get('/patient/{id}', 'PatientController@show');
  181. Route::put('/patient/{id}', 'PatientController@update');
  182. Route::delete('/patient/{id}', 'PatientController@destroy');
  183. Route::post('/patient-export', 'PatientController@export');
  184. //分类
  185. Route::get('/category', 'CategoryController@index');
  186. Route::get('category-tree', 'CategoryController@tree');
  187. Route::post('category', 'CategoryController@store');
  188. Route::put('category/{id}', 'CategoryController@update');
  189. Route::delete('category/{id}', 'CategoryController@destroy');
  190. //病历
  191. Route::get('/medical-record', 'MedicalRecordController@index');
  192. Route::post('/medical-record', 'MedicalRecordController@store');
  193. Route::get('/medical-record/{id}', 'MedicalRecordController@show');
  194. Route::put('/medical-record/{id}', 'MedicalRecordController@update');
  195. Route::delete('/medical-record/{id}', 'MedicalRecordController@destroy');
  196. //处方
  197. Route::get('/prescription', 'PrescriptionController@index');
  198. Route::post('/prescription', 'PrescriptionController@store');
  199. Route::get('/prescription/{id}', 'PrescriptionController@show');
  200. Route::put('/prescription/{id}', 'PrescriptionController@update');
  201. Route::delete('/prescription/{id}', 'PrescriptionController@destroy');
  202. Route::get('/prescription-options', 'PrescriptionController@options');
  203. Route::post('/prescription-import', 'PrescriptionController@import');
  204. //药物
  205. Route::get('/drug', 'DrugController@index');
  206. Route::post('/drug', 'DrugController@store');
  207. Route::get('/drug/{id}', 'DrugController@show');
  208. Route::put('/drug/{id}', 'DrugController@update');
  209. Route::delete('/drug/{id}', 'DrugController@destroy');
  210. Route::get('/drug-lists', 'DrugController@lists');
  211. Route::post('/drug/delete', 'DrugController@delete');
  212. Route::post('/drug-import', 'DrugController@import');
  213. //快速创建
  214. Route::post('/quick-store', 'PrescriptionController@quickStore');
  215. //分析
  216. Route::get('/analyse', 'AnalyseController@index');
  217. Route::get('/analyse-drug', 'AnalyseController@drug');
  218. });
  219. Route::group(['prefix' => 'cms', 'namespace' => 'CMS'], function () {
  220. //轮播图管理
  221. Route::get('banner', 'BannersController@index');
  222. Route::get('banner/{id}', 'BannersController@show');
  223. Route::post('banner', 'BannersController@store');
  224. Route::post('banner/delete', 'BannersController@delete');
  225. Route::put('banner/{id}', 'BannersController@update');
  226. Route::delete('banner/{id}', 'BannersController@destroy');
  227. //分类
  228. Route::get('category', 'CategoriesController@index');
  229. Route::post('category', 'CategoriesController@store');
  230. Route::get('category/{id}', 'CategoriesController@show');
  231. Route::put('category/{id}', 'CategoriesController@update');
  232. Route::delete('category/{id}', 'CategoriesController@destroy');
  233. Route::post('category/delete', 'CategoriesController@delete');
  234. Route::get('category-tree', 'CategoriesController@tree');
  235. Route::get('category-type', 'CategoriesController@type');
  236. //信息
  237. Route::get('article', 'ArticlesController@index');
  238. Route::post('article', 'ArticlesController@store');
  239. Route::get('article/{id}', 'ArticlesController@show');
  240. Route::put('article/{id}', 'ArticlesController@update');
  241. Route::delete('article/{id}', 'ArticlesController@destroy');
  242. Route::post('article/delete', 'ArticlesController@delete');
  243. //配置
  244. Route::get('setting', 'SettingsController@index');
  245. Route::post('setting', 'SettingsController@store');
  246. Route::get('setting/{id}', 'SettingsController@show');
  247. Route::put('setting/{id}', 'SettingsController@update');
  248. Route::delete('setting/{id}', 'SettingsController@destroy');
  249. Route::post('setting/delete', 'SettingsController@delete');
  250. });
  251. });
  252. //附件下载
  253. //Route::get('/view/attach-download/{id}', 'Course\AttachController@download');
  254. Route::get('/', function () {
  255. return app()->version();
  256. });
  257. //开发环境接口
  258. Route::group(['prefix' => 'develop'], function () {
  259. //响应状态
  260. // Route::get('/http-status', 'DevelopController@httpStatus');
  261. Route::post('/t', 'ExampleController@test');
  262. Route::get('/init', 'ExampleController@init');
  263. });
  264. //
  265. //Route::get('author', function () {
  266. // $response = Http::withOptions(['timeout' => 3])->get('https://api.github.com/users/Jiannei');
  267. // $response->throw();
  268. //
  269. // return Response::success($response->json());
  270. //});
  271. //
  272. //// 测试路由
  273. //Route::group(['prefix' => 'test'], function () {
  274. // Route::get('configurations', 'ExampleController@configurations');
  275. // Route::get('logs', ['uses' => 'ExampleController@logs', 'middleware' => 'throttle:5,1']);
  276. // Route::put('roles', 'ExampleController@syncRoles');
  277. // Route::put('permissions', 'ExampleController@syncPermissions');
  278. //
  279. // Route::get('posts', 'PostsController@index');
  280. //});
  281. //
  282. //// 用户管理
  283. //Route::post('users', 'UsersController@store');
  284. //Route::get('users/{id}', 'UsersController@show');
  285. //Route::get('users', 'UsersController@index');
  286. //Route::get('users/pagination/simple', 'UsersController@simple');
  287. //Route::get('users/pagination/cursor', 'UsersController@cursor');
  288. //
  289. //// 授权管理
  290. //Route::post('authorization', 'AuthorizationController@store');
  291. //Route::delete('authorization', 'AuthorizationController@destroy');
  292. //Route::put('authorization', 'AuthorizationController@update');
  293. //Route::get('authorization', 'AuthorizationController@show');