router.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572
  1. 'use strict';
  2. /**
  3. * @param {Egg.Application} app - egg application
  4. */
  5. module.exports = app => {
  6. const { router, controller } = app;
  7. router.get('/', controller.home.index);
  8. // 共通查询单条记录方法
  9. router.get('/api/train/common/findone/:modelname', controller.common.findone);
  10. // 共通批量查询方法
  11. router.post(
  12. '/api/train/common/findbyids/:modelname',
  13. controller.common.findbyids
  14. );
  15. // 共通查询表
  16. router.get('/api/train/common/findbymodel', controller.common.findbymodel);
  17. router.get('/api/train/common/findyear', controller.common.findyear);
  18. // 基础设置表路由
  19. router.get('/api/train/setting/findone', controller.setting.findone);
  20. router.resources('setting', '/api/train/setting', controller.setting); // index、create、show、destroy
  21. router.post(
  22. 'setting',
  23. '/api/train/setting/update/:id',
  24. controller.setting.update
  25. );
  26. // 科目表设置路由
  27. router.resources('subject', '/api/train/subject', controller.subject); // index、create、show、destroy
  28. router.post(
  29. 'subject',
  30. '/api/train/subject/update/:id',
  31. controller.subject.update
  32. );
  33. // 教师表设置路由
  34. router.get('teacher', '/api/train/teacher/show/:id', controller.teacher.show);
  35. router.resources('teacher', '/api/train/teacher', controller.teacher); // index、create、show、destroy
  36. router.post(
  37. 'teacher',
  38. '/api/train/teacher/update/:id',
  39. controller.teacher.update
  40. );
  41. router.post(
  42. 'teacher',
  43. '/api/train/teacher/status',
  44. controller.teacher.status
  45. );
  46. router.post('/api/train/teacher/teaimport', controller.teacher.teaimport);
  47. // 作业表配置路由
  48. router.resources('task', '/api/train/task', controller.task); // index、create、show、destroy
  49. router.post('task', '/api/train/task/update/:id', controller.task.update);
  50. // 问卷题库表配置路由
  51. router.resources('question', '/api/train/question', controller.question); // index、create、show、destroy
  52. router.post(
  53. 'question',
  54. '/api/train/question/update/:id',
  55. controller.question.update
  56. );
  57. // 问卷表配置路由
  58. router.post(
  59. 'questionnaire',
  60. '/api/train/questionnaire',
  61. controller.questionnaire.create
  62. );
  63. router.delete(
  64. 'questionnaire',
  65. '/api/train/questionnaire/:id',
  66. controller.questionnaire.delete
  67. );
  68. router.post(
  69. 'questionnaire',
  70. '/api/train/questionnaire/update/:id',
  71. controller.questionnaire.update
  72. );
  73. router.get(
  74. 'questionnaire',
  75. '/api/train/questionnaire',
  76. controller.questionnaire.query
  77. );
  78. router.get(
  79. 'questionnaire',
  80. '/api/train/questionnaire/show/:id',
  81. controller.questionnaire.show
  82. );
  83. // 学生表设置路由
  84. router.get(
  85. 'sutdent',
  86. '/api/train/student/findscore',
  87. controller.student.findscore
  88. );
  89. router.get(
  90. 'sutdent',
  91. '/api/train/student/findbedroom',
  92. controller.student.findbedroom
  93. );
  94. router.get('sutdent', '/api/train/student/seek', controller.student.seek);
  95. router.resources('student', '/api/train/student', controller.student); // index、create、show、destroy
  96. router.post(
  97. 'student',
  98. '/api/train/student/update/:id',
  99. controller.student.update
  100. );
  101. router.post('student', '/api/train/student/upjob', controller.student.upjob);
  102. router.post(
  103. 'student',
  104. '/api/train/student/deleteclass',
  105. controller.student.deleteclass
  106. ); // 删除学生班级
  107. router.post(
  108. 'student',
  109. '/api/train/student/findbystuids',
  110. controller.student.findbystuids
  111. );
  112. router.post(
  113. 'student',
  114. '/api/train/student/deletestus',
  115. controller.student.deletestus
  116. ); // 删除学生多条
  117. router.post(
  118. 'student',
  119. '/api/train/student/updatabedroom',
  120. controller.student.updatabedroom
  121. ); // 批量学生寝室号
  122. // 班主任表设置路由
  123. router.resources(
  124. 'headteacher',
  125. '/api/train/headteacher',
  126. controller.headteacher
  127. ); // index、create、show、destroy
  128. router.post(
  129. 'headteacher',
  130. '/api/train/headteacher/update/:id',
  131. controller.headteacher.update
  132. );
  133. // 寝室表设置路由
  134. router.get('/api/train/bedroom/student/:id', controller.bedroom.roomstu); // 根据班级id查询寝室信息
  135. router.resources('bedroom', '/api/train/bedroom', controller.bedroom); // index、create、show、destroy
  136. router.post(
  137. 'bedroom',
  138. '/api/train/bedroom/update/:id',
  139. controller.bedroom.update
  140. );
  141. router.post('bedroom', '/api/train/bedroom/apart', controller.bedroom.apart);
  142. router.post(
  143. 'bedroom',
  144. '/api/train/bedroom/ibeacon',
  145. controller.bedroom.ibeacon
  146. );
  147. // 班级表设置路由
  148. router.get(
  149. 'class',
  150. '/api/train/class/classinfo/:id',
  151. controller.class.classinfo
  152. );
  153. router.post(
  154. 'class',
  155. '/api/train/class/upclasses',
  156. controller.class.upclasses
  157. );
  158. router.post('class', '/api/train/class/notice', controller.class.notice);
  159. router.resources('class', '/api/train/class', controller.class); // index、create、show、destroy
  160. router.post('class', '/api/train/class/update/:id', controller.class.update);
  161. router.post('class', '/api/train/class/divide', controller.class.divide);
  162. router.post('class', '/api/train/class/uptea', controller.class.uptea);
  163. router.post(
  164. 'class',
  165. '/api/train/class/upstuclass/:id',
  166. controller.class.studentupclass
  167. ); // 学生修改班级
  168. // 部门表设置路由
  169. router.resources(
  170. 'department',
  171. '/api/train/department',
  172. controller.department
  173. ); // index、create、show、destroy
  174. router.post(
  175. 'department',
  176. '/api/train/department/update/:id',
  177. controller.department.update
  178. );
  179. // 位置表设置路由
  180. router.resources('location', '/api/train/location', controller.location); // index、create、show、destroy
  181. router.post(
  182. 'location',
  183. '/api/train/location/update/:id',
  184. controller.location.update
  185. );
  186. // 培训计划表设置路由
  187. router.resources('trainplan', '/api/train/trainplan', controller.trainplan); // index、create、show、destroy
  188. router.post(
  189. 'trainplan',
  190. '/api/train/trainplan/update/:id',
  191. controller.trainplan.update
  192. );
  193. router.post(
  194. '/api/train/trainplan/exportExcel',
  195. controller.trainplan.exportExcel
  196. ); // 导出
  197. router.post(
  198. '/api/train/trainplan/exportSchool',
  199. controller.trainplan.exportSchool
  200. ); // 导出计划学校
  201. router.post(
  202. '/api/train/trainplan/exportPlan',
  203. controller.trainplan.exportPlan
  204. ); // 导出计划日历
  205. router.post(
  206. '/api/train/trainplan/updateclass',
  207. controller.trainplan.updateclass
  208. );
  209. router.post(
  210. '/api/train/trainplan/updatereteacher',
  211. controller.trainplan.updatereteacher
  212. );
  213. // 培训计划年度批次表设置路由
  214. router.resources(
  215. 'trainplanyear',
  216. '/api/train/trainplanyear',
  217. controller.trainplanyear
  218. ); // index、create、show、destroy
  219. router.post(
  220. 'trainplanyear',
  221. '/api/train/trainplanyear/update/:id',
  222. controller.trainplanyear.update
  223. );
  224. // 节假日表设置路由
  225. router.resources('festival', '/api/train/festival', controller.festival); // index、create、show、destroy
  226. router.post(
  227. 'festival',
  228. '/api/train/festival/update/:id',
  229. controller.festival.update
  230. );
  231. // 课程表设置路由
  232. router.get('/api/train/lesson/teaclass', controller.lesson.teaclass);
  233. router.post(
  234. 'lesson',
  235. '/api/train/lesson/uplessones',
  236. controller.lesson.uplessones
  237. );
  238. router.get('/api/train/lesson/classbyteaid', controller.lesson.classbyteaid); // 根据计划id与教师id查询班级信息
  239. router.resources('lesson', '/api/train/lesson', controller.lesson); // index、create、show、destroy
  240. router.post(
  241. 'lesson',
  242. '/api/train/lesson/update/:id',
  243. controller.lesson.update
  244. );
  245. router.post(
  246. 'lesson',
  247. '/api/train/lesson/autolesson/:id',
  248. controller.lesson.autolesson
  249. ); // 自动排课
  250. router.post('lesson', '/api/train/lesson/check', controller.lesson.check); // 确定(锁死)课表
  251. // 培训计划学校上报时间表设置路由
  252. router.resources('schtime', '/api/train/schtime', controller.schtime); // index、create、show、destroy
  253. router.post(
  254. 'schtime',
  255. '/api/train/schtime/update/:id',
  256. controller.schtime.update
  257. );
  258. router.post(
  259. 'schtime',
  260. '/api/train/schtime/updateschtimes',
  261. controller.schtime.updateschtimes
  262. );
  263. // 班主任全年计划表设置路由
  264. router.get('teaplan', '/api/train/teaplan/divide', controller.teaplan.divide);
  265. router.get(
  266. 'teaplan',
  267. '/api/train/teaplan/findteacher',
  268. controller.teaplan.findteacher
  269. );
  270. router.resources('teaplan', '/api/train/teaplan', controller.teaplan); // index、create、show、destroy
  271. router.post(
  272. 'teaplan',
  273. '/api/train/teaplan/update/:id',
  274. controller.teaplan.update
  275. );
  276. // 教师申请讲课表设置路由
  277. router.get(
  278. 'apply',
  279. '/api/train/apply/queryteacher',
  280. controller.apply.queryteacher
  281. );
  282. router.resources('apply', '/api/train/apply', controller.apply); // index、create、show、destroy
  283. router.post('apply', '/api/train/apply/update/:id', controller.apply.update);
  284. // 请假表设置路由
  285. router.resources('leave', '/api/train/leave', controller.leave); // index、create、show、destroy
  286. router.post('leave', '/api/train/leave/update/:id', controller.leave.update);
  287. // 分组表设置路由
  288. router.resources('group', '/api/train/group', controller.group); // index、create、show、destroy
  289. router.post('group', '/api/train/group/update/:id', controller.group.update);
  290. router.post('group', '/api/train/group/insert', controller.group.insert);
  291. router.post('group', '/api/train/group/exit', controller.group.exit);
  292. router.post('group', '/api/train/group/sethead', controller.group.sethead);
  293. router.post(
  294. 'group',
  295. '/api/train/group/findbystuid',
  296. controller.group.findbystuid
  297. );
  298. // 职责说明表设置路由
  299. router.resources('duty', '/api/train/duty', controller.duty); // index、create、show、destroy
  300. router.post('duty', '/api/train/duty/update/:id', controller.duty.update);
  301. // 学生上传作业表设置路由
  302. router.resources(
  303. 'uploadtask',
  304. '/api/train/uploadtask',
  305. controller.uploadtask
  306. ); // index、create、show、destroy
  307. router.post(
  308. 'uploadtask',
  309. '/api/train/uploadtask/update/:id',
  310. controller.uploadtask.update
  311. );
  312. // 学生上传问卷表设置路由
  313. router.get(
  314. '/api/train/uploadquestion/completion',
  315. controller.uploadquestion.completion
  316. ); // 统计完成度
  317. router.resources(
  318. 'uploadquestion',
  319. '/api/train/uploadquestion',
  320. controller.uploadquestion
  321. ); // index、create、show、destroy
  322. router.post(
  323. 'uploadquestion',
  324. '/api/train/uploadquestion/update/:id',
  325. controller.uploadquestion.update
  326. );
  327. // 考勤表设置路由
  328. router.get('/api/train/attendance/wxauth', controller.attendance.wxauth); // 统计完成度
  329. router.resources(
  330. 'attendance',
  331. '/api/train/attendance',
  332. controller.attendance
  333. ); // index、create、show、destroy
  334. router.post(
  335. 'attendance',
  336. '/api/train/attendance/update/:id',
  337. controller.attendance.update
  338. );
  339. router.post(
  340. 'attendance',
  341. '/api/train/attendance/attendancecreate',
  342. controller.attendance.attendancecreate
  343. );
  344. router.post(
  345. 'attendance',
  346. '/api/train/attendance/attendancecreateList',
  347. controller.attendance.attendancecreateList
  348. );
  349. // 学校上传学生名单
  350. router.resources('school', '/api/train/school', controller.school); // index、create、show、destroy
  351. router.post(
  352. 'school',
  353. '/api/train/school/update/:id',
  354. controller.school.update
  355. );
  356. router.post('/api/train/school/import', controller.school.stuimport); // 名单上传
  357. // 民族表设置路由
  358. router.resources('nation', '/api/train/nation', controller.nation); // index、create、show、destroy
  359. router.post(
  360. 'nation',
  361. '/api/train/nation/update/:id',
  362. controller.nation.update
  363. );
  364. // 行政区划表设置路由
  365. router.resources('region', '/api/train/region', controller.region); // index、create、show、destroy
  366. router.post(
  367. 'region',
  368. '/api/train/region/update/:id',
  369. controller.region.update
  370. );
  371. // 用户表设置路由
  372. router.get('/api/train/user/schoolregister', controller.user.schoolregister); // 学校账号一键生成
  373. router.resources('user', '/api/train/user', controller.user); // index、create、show、destroy
  374. router.post('user', '/api/train/user/update/:id', controller.user.update);
  375. router.post('user', '/api/train/user/register', controller.user.register); // 学校注册
  376. router.post('user', '/api/train/user/bind', controller.user.bind); // 学生微信绑定
  377. router.post('user', '/api/train/user/userbind', controller.user.userbind); // 其他用户微信绑定
  378. router.post('user', '/api/train/user/appbind', controller.user.appbind); // 绑定小程序openid
  379. // 行政区划表设置路由
  380. router.resources('termquest', '/api/train/termquest', controller.termquest); // index、create、show、destroy
  381. router.post(
  382. 'termquest',
  383. '/api/train/termquest/update/:id',
  384. controller.termquest.update
  385. );
  386. // 微信端访问地址
  387. router.get('/api/train/auth', controller.weixin.auth); // 微信登录
  388. // 微信端访问地址
  389. router.get('/api/train/authtest', controller.weixin.authTest); // 微信登录测试
  390. // pc端登录
  391. router.post('/api/train/login', controller.login.login); // 登录
  392. // 微信端登录
  393. router.get('/api/train/qrcode', controller.login.qrcode); // 登录
  394. router.post('/api/train/wxcheck', controller.login.wxcheck); // 微信检查登录
  395. router.post('/api/train/wxlogin', controller.login.wxlogin); // 登录
  396. // 评分表设置路由
  397. router.resources('score', '/api/train/score', controller.score); // index、create、show、destroy
  398. router.post('score', '/api/train/score/update/:id', controller.score.update);
  399. // 上传资料表设置路由
  400. router.resources('material', '/api/train/material', controller.material); // index、create、show、destroy
  401. router.post(
  402. 'material',
  403. '/api/train/material/update/:id',
  404. controller.material.update
  405. );
  406. // 资料评分表设置路由
  407. router.resources(
  408. 'materialscore',
  409. '/api/train/materialscore',
  410. controller.materialscore
  411. ); // index、create、show、destroy
  412. router.post(
  413. 'materialscore',
  414. '/api/train/materialscore/update/:id',
  415. controller.materialscore.update
  416. );
  417. // 教师在线表设置路由
  418. router.resources('online', '/api/train/online', controller.online); // index、create、show、destroy
  419. router.post(
  420. 'online',
  421. '/api/train/online/update/:id',
  422. controller.online.update
  423. );
  424. // 聊天房间表设置路由
  425. router.resources('room', '/api/train/room', controller.room); // index、create、show、destroy
  426. router.post('room', '/api/train/room/update/:id', controller.room.update);
  427. // 聊天记录表设置路由
  428. router.resources('record', '/api/train/record', controller.record); // index、create、show、destroy
  429. router.post(
  430. 'record',
  431. '/api/train/record/update/:id',
  432. controller.record.update
  433. );
  434. // 通知表设置路由
  435. router.resources('notice', '/api/train/notice', controller.notice); // index、create、show、destroy
  436. router.post(
  437. 'notice',
  438. '/api/train/notice/update/:id',
  439. controller.notice.update
  440. );
  441. router.post('notice', '/api/train/notice/look', controller.notice.look);
  442. // 课程模板表设置路由
  443. router.resources(
  444. 'lessonmode',
  445. '/api/train/lessonmode',
  446. controller.lessonmode
  447. ); // index、create、show、destroy
  448. router.post(
  449. 'lessonmode',
  450. '/api/train/lessonmode/update/:id',
  451. controller.lessonmode.update
  452. );
  453. // 全年计划模板表设置路由
  454. router.resources(
  455. 'trainmodel',
  456. '/api/train/trainmodel',
  457. controller.trainmodel
  458. ); // index、create、show、destroy
  459. router.post(
  460. 'trainmodel',
  461. '/api/train/trainmodel/update/:id',
  462. controller.trainmodel.update
  463. );
  464. // 统计查询设置路由
  465. router.get('/api/train/count/countstudent', controller.count.countstudent);
  466. // 按学校统计查询设置路由
  467. router.get('/api/train/count/countschstu/:id', controller.count.countschstu);
  468. // 班级类型表配置路由
  469. router.resources('classtype', '/api/train/classtype', controller.classtype); // index、create、show、destroy
  470. router.post(
  471. 'classtype',
  472. '/api/train/classtype/update/:id',
  473. controller.classtype.update
  474. );
  475. // 学校上传任务表设置路由
  476. router.resources('job', '/api/train/job', controller.job); // index、create、show、destroy
  477. router.post('job', '/api/train/job/update/:id', controller.job.update);
  478. // 消息表设置路由
  479. router.resources('message', '/api/train/message', controller.message); // index、create、show、destroy
  480. router.post(
  481. 'message',
  482. '/api/train/message/update/:id',
  483. controller.message.update
  484. );
  485. // 直播房间
  486. router.resources('liveroom', '/api/train/liveroom', controller.liveroom); // index、create、show、destroy
  487. router.post(
  488. 'liveroom',
  489. '/api/train/liveroom/update/:id',
  490. controller.liveroom.update
  491. );
  492. // 培训视频
  493. router.resources(
  494. 'trainvideo',
  495. '/api/train/trainvideo',
  496. controller.trainvideo
  497. ); // index、create、show、destroy
  498. router.post(
  499. 'trainvideo',
  500. '/api/train/trainvideo/update/:id',
  501. controller.trainvideo.update
  502. );
  503. // 答疑申请(教师)
  504. router.resources('answerapply', '/api/train/answerapply', controller.answerapply); // index、create、show、destroy
  505. router.post(
  506. 'answerapply',
  507. '/api/train/answerapply/update/:id',
  508. controller.answerapply.update
  509. );
  510. // 答疑房间
  511. router.resources('chatroom', '/api/train/chatroom', controller.chatroom); // index、create、show、destroy
  512. router.post(
  513. 'chatroom',
  514. '/api/train/chatroom/update/:id',
  515. controller.chatroom.update
  516. );
  517. // 答疑对话
  518. router.resources(
  519. 'answerchat',
  520. '/api/train/answerchat',
  521. controller.answerchat
  522. ); // index、create、show、destroy
  523. router.post(
  524. 'answerchat',
  525. '/api/train/answerchat/update/:id',
  526. controller.answerchat.update
  527. );
  528. };