router.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656
  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. router.post('/api/train/teacher/fetchteachers', controller.teacher.fetchteachers);
  48. // 作业表配置路由
  49. router.resources('task', '/api/train/task', controller.task); // index、create、show、destroy
  50. router.post('task', '/api/train/task/update/:id', controller.task.update);
  51. // 问卷题库表配置路由
  52. router.resources('question', '/api/train/question', controller.question); // index、create、show、destroy
  53. router.post(
  54. 'question',
  55. '/api/train/question/update/:id',
  56. controller.question.update
  57. );
  58. // 问卷表配置路由
  59. router.post(
  60. 'questionnaire',
  61. '/api/train/questionnaire',
  62. controller.questionnaire.create
  63. );
  64. router.delete(
  65. 'questionnaire',
  66. '/api/train/questionnaire/:id',
  67. controller.questionnaire.delete
  68. );
  69. router.post(
  70. 'questionnaire',
  71. '/api/train/questionnaire/update/:id',
  72. controller.questionnaire.update
  73. );
  74. router.get(
  75. 'questionnaire',
  76. '/api/train/questionnaire',
  77. controller.questionnaire.query
  78. );
  79. router.get(
  80. 'questionnaire',
  81. '/api/train/questionnaire/show/:id',
  82. controller.questionnaire.show
  83. );
  84. // 班级学生排号
  85. router.get('sutdent', '/api/train/student/arrangeNumber', controller.student.arrangeNumber);
  86. router.post(
  87. 'student',
  88. '/api/train/student/export',
  89. controller.student.exportStudent
  90. );
  91. // 学生表设置路由
  92. router.get(
  93. 'sutdent',
  94. '/api/train/student/finestudent/:id',
  95. controller.student.finestudent
  96. );
  97. router.get(
  98. 'sutdent',
  99. '/api/train/student/findscore',
  100. controller.student.findscore
  101. );
  102. router.get(
  103. 'sutdent',
  104. '/api/train/student/findbedroom',
  105. controller.student.findbedroom
  106. );
  107. router.get('sutdent', '/api/train/student/seek', controller.student.seek);
  108. router.resources('student', '/api/train/student', controller.student); // index、create、show、destroy
  109. router.post(
  110. 'student',
  111. '/api/train/student/update/:id',
  112. controller.student.update
  113. );
  114. router.post('student', '/api/train/student/upjob', controller.student.upjob);
  115. router.post(
  116. 'student',
  117. '/api/train/student/deleteclass',
  118. controller.student.deleteclass
  119. ); // 删除学生班级
  120. router.post(
  121. 'student',
  122. '/api/train/student/findbystuids',
  123. controller.student.findbystuids
  124. );
  125. router.post(
  126. 'student',
  127. '/api/train/student/deletestus',
  128. controller.student.deletestus
  129. ); // 删除学生多条
  130. router.post(
  131. 'student',
  132. '/api/train/student/updatabedroom',
  133. controller.student.updatabedroom
  134. ); // 批量学生寝室号
  135. // 班主任表设置路由
  136. router.resources(
  137. 'headteacher',
  138. '/api/train/headteacher',
  139. controller.headteacher
  140. ); // index、create、show、destroy
  141. router.post(
  142. 'headteacher',
  143. '/api/train/headteacher/update/:id',
  144. controller.headteacher.update
  145. );
  146. // 查询该期还可以使用的寝室
  147. router.get('bedroom', '/api/train/bedroom/assignroom', controller.bedroom.getAssignRoom);
  148. // 批量修改寝室(新)
  149. router.post('bedroom', '/api/train/bedroom/batch', controller.bedroom.updateStudent);
  150. // 寝室表设置路由
  151. router.get('/api/train/bedroom/student/:id', controller.bedroom.roomstu); // 根据班级id查询寝室信息
  152. router.resources('bedroom', '/api/train/bedroom', controller.bedroom); // index、create、show、destroy
  153. router.post(
  154. 'bedroom',
  155. '/api/train/bedroom/update/:id',
  156. controller.bedroom.update
  157. );
  158. router.post('bedroom', '/api/train/bedroom/apart', controller.bedroom.apart);
  159. router.post(
  160. 'bedroom',
  161. '/api/train/bedroom/ibeacon',
  162. controller.bedroom.ibeacon
  163. );
  164. // 班级表设置路由
  165. router.get(
  166. 'class',
  167. '/api/train/class/classinfo/:id',
  168. controller.class.classinfo
  169. );
  170. router.post(
  171. 'class',
  172. '/api/train/class/upclasses',
  173. controller.class.upclasses
  174. );
  175. router.post('class', '/api/train/class/notice', controller.class.notice);
  176. router.resources('class', '/api/train/class', controller.class); // index、create、show、destroy
  177. router.post('class', '/api/train/class/update/:id', controller.class.update);
  178. router.post('class', '/api/train/class/divide', controller.class.divide);
  179. router.post('class', '/api/train/class/uptea', controller.class.uptea);
  180. router.post(
  181. 'class',
  182. '/api/train/class/upstuclass/:id',
  183. controller.class.studentupclass
  184. ); // 学生修改班级
  185. // 部门表设置路由
  186. router.resources(
  187. 'department',
  188. '/api/train/department',
  189. controller.department
  190. ); // index、create、show、destroy
  191. router.post(
  192. 'department',
  193. '/api/train/department/update/:id',
  194. controller.department.update
  195. );
  196. // 位置表设置路由
  197. router.resources('location', '/api/train/location', controller.location); // index、create、show、destroy
  198. router.post(
  199. 'location',
  200. '/api/train/location/update/:id',
  201. controller.location.update
  202. );
  203. // 培训计划表设置路由
  204. router.resources('trainplan', '/api/train/trainplan', controller.trainplan); // index、create、show、destroy
  205. router.post(
  206. 'trainplan',
  207. '/api/train/trainplan/update/:id',
  208. controller.trainplan.update
  209. );
  210. router.post(
  211. '/api/train/trainplan/exportExcel',
  212. controller.trainplan.exportExcel
  213. ); // 导出
  214. router.post(
  215. '/api/train/trainplan/exportSchool',
  216. controller.trainplan.exportSchool
  217. ); // 导出计划学校
  218. router.post(
  219. '/api/train/trainplan/exportPlan',
  220. controller.trainplan.exportPlan
  221. ); // 导出计划日历
  222. router.post(
  223. '/api/train/trainplan/updateclass',
  224. controller.trainplan.updateclass
  225. );
  226. router.post(
  227. '/api/train/trainplan/updatereteacher',
  228. controller.trainplan.updatereteacher
  229. );
  230. // 培训计划年度批次表设置路由
  231. router.resources(
  232. 'trainplanyear',
  233. '/api/train/trainplanyear',
  234. controller.trainplanyear
  235. ); // index、create、show、destroy
  236. router.post(
  237. 'trainplanyear',
  238. '/api/train/trainplanyear/update/:id',
  239. controller.trainplanyear.update
  240. );
  241. // 节假日表设置路由
  242. router.resources('festival', '/api/train/festival', controller.festival); // index、create、show、destroy
  243. router.post(
  244. 'festival',
  245. '/api/train/festival/update/:id',
  246. controller.festival.update
  247. );
  248. // 新自动排课表
  249. router.post('/api/train/lesson/newarrange', controller.lesson.newArrange);
  250. // 课程表设置路由
  251. router.get('/api/train/lesson/teaclass', controller.lesson.teaclass);
  252. router.post(
  253. 'lesson',
  254. '/api/train/lesson/uplessones',
  255. controller.lesson.uplessones
  256. );
  257. router.get('/api/train/lesson/classbyteaid', controller.lesson.classbyteaid); // 根据计划id与教师id查询班级信息
  258. router.resources('lesson', '/api/train/lesson', controller.lesson); // index、create、show、destroy
  259. router.post(
  260. 'lesson',
  261. '/api/train/lesson/update/:id',
  262. controller.lesson.update
  263. );
  264. router.post(
  265. 'lesson',
  266. '/api/train/lesson/autolesson/:id',
  267. controller.lesson.autolesson
  268. ); // 自动排课
  269. router.post('lesson', '/api/train/lesson/check', controller.lesson.check); // 确定(锁死)课表
  270. // 培训计划学校上报时间表设置路由
  271. router.resources('schtime', '/api/train/schtime', controller.schtime); // index、create、show、destroy
  272. router.post(
  273. 'schtime',
  274. '/api/train/schtime/update/:id',
  275. controller.schtime.update
  276. );
  277. router.post(
  278. 'schtime',
  279. '/api/train/schtime/updateschtimes',
  280. controller.schtime.updateschtimes
  281. );
  282. // 班主任全年计划表设置路由
  283. router.get('teaplan', '/api/train/teaplan/divide', controller.teaplan.divide);
  284. router.get(
  285. 'teaplan',
  286. '/api/train/teaplan/findteacher',
  287. controller.teaplan.findteacher
  288. );
  289. router.resources('teaplan', '/api/train/teaplan', controller.teaplan); // index、create、show、destroy
  290. router.post(
  291. 'teaplan',
  292. '/api/train/teaplan/update/:id',
  293. controller.teaplan.update
  294. );
  295. // 计划自动排教师
  296. router.get('apply', '/api/train/apply/arrange', controller.apply.arrange);
  297. // 计划自动排教师
  298. router.post('apply', '/api/train/apply/sendmsg/:planid', controller.apply.sendmsg);
  299. // 计划自动排教师
  300. router.post('apply', '/api/train/apply/confirm/:planid', controller.apply.confirm);
  301. // 教师申请讲课表设置路由
  302. router.get(
  303. 'apply',
  304. '/api/train/apply/queryteacher',
  305. controller.apply.queryteacher
  306. );
  307. router.resources('apply', '/api/train/apply', controller.apply); // index、create、show、destroy
  308. router.post('apply', '/api/train/apply/update/:id', controller.apply.update);
  309. // 请假表设置路由
  310. router.resources('leave', '/api/train/leave', controller.leave); // index、create、show、destroy
  311. router.post('leave', '/api/train/leave/update/:id', controller.leave.update);
  312. // 分组表设置路由
  313. // 还原小组锁定
  314. router.get('group', '/api/train/group/returns/:classid', controller.group.returns);
  315. router.resources('group', '/api/train/group', controller.group); // index、create、show、destroy
  316. router.post('group', '/api/train/group/update/:id', controller.group.update);
  317. router.post('group', '/api/train/group/insert', controller.group.insert);
  318. router.post('group', '/api/train/group/exit', controller.group.exit);
  319. router.post('group', '/api/train/group/sethead', controller.group.sethead);
  320. router.post(
  321. 'group',
  322. '/api/train/group/findbystuid',
  323. controller.group.findbystuid
  324. );
  325. // 职责说明表设置路由
  326. router.resources('duty', '/api/train/duty', controller.duty); // index、create、show、destroy
  327. router.post('duty', '/api/train/duty/update/:id', controller.duty.update);
  328. // 学生上传作业表设置路由
  329. router.resources(
  330. 'uploadtask',
  331. '/api/train/uploadtask',
  332. controller.uploadtask
  333. ); // index、create、show、destroy
  334. router.post(
  335. 'uploadtask',
  336. '/api/train/uploadtask/update/:id',
  337. controller.uploadtask.update
  338. );
  339. // 学生上传问卷表设置路由
  340. router.get(
  341. '/api/train/uploadquestion/completion',
  342. controller.uploadquestion.completion
  343. ); // 统计完成度
  344. router.resources(
  345. 'uploadquestion',
  346. '/api/train/uploadquestion',
  347. controller.uploadquestion
  348. ); // index、create、show、destroy
  349. router.post(
  350. 'uploadquestion',
  351. '/api/train/uploadquestion/update/:id',
  352. controller.uploadquestion.update
  353. );
  354. // 考勤表设置路由
  355. router.get('/api/train/attendance/wxauth', controller.attendance.wxauth); // 统计完成度
  356. router.resources(
  357. 'attendance',
  358. '/api/train/attendance',
  359. controller.attendance
  360. ); // index、create、show、destroy
  361. router.post(
  362. 'attendance',
  363. '/api/train/attendance/update/:id',
  364. controller.attendance.update
  365. );
  366. router.post(
  367. 'attendance',
  368. '/api/train/attendance/attendancecreate',
  369. controller.attendance.attendancecreate
  370. );
  371. router.post(
  372. 'attendance',
  373. '/api/train/attendance/attendancecreateList',
  374. controller.attendance.attendancecreateList
  375. );
  376. // 学校上传学生名单
  377. router.resources('school', '/api/train/school', controller.school); // index、create、show、destroy
  378. router.post(
  379. 'school',
  380. '/api/train/school/update/:id',
  381. controller.school.update
  382. );
  383. router.post('/api/train/school/import', controller.school.stuimport); // 名单上传
  384. // 民族表设置路由
  385. router.resources('nation', '/api/train/nation', controller.nation); // index、create、show、destroy
  386. router.post(
  387. 'nation',
  388. '/api/train/nation/update/:id',
  389. controller.nation.update
  390. );
  391. // 行政区划表设置路由
  392. router.resources('region', '/api/train/region', controller.region); // index、create、show、destroy
  393. router.post(
  394. 'region',
  395. '/api/train/region/update/:id',
  396. controller.region.update
  397. );
  398. // 用户表设置路由
  399. router.get('/api/train/user/schoolregister', controller.user.schoolregister); // 学校账号一键生成
  400. router.resources('user', '/api/train/user', controller.user); // index、create、show、destroy
  401. router.post('user', '/api/train/user/update/:id', controller.user.update);
  402. router.post('user', '/api/train/user/register', controller.user.register); // 学校注册
  403. router.post('user', '/api/train/user/bind', controller.user.bind); // 学生微信绑定
  404. router.post('user', '/api/train/user/userbind', controller.user.userbind); // 其他用户微信绑定
  405. router.post('user', '/api/train/user/appbind', controller.user.appbind); // 绑定小程序openid
  406. // 行政区划表设置路由
  407. router.resources('termquest', '/api/train/termquest', controller.termquest); // index、create、show、destroy
  408. router.post(
  409. 'termquest',
  410. '/api/train/termquest/update/:id',
  411. controller.termquest.update
  412. );
  413. // 微信端访问地址
  414. router.get('/api/train/auth', controller.weixin.auth); // 微信登录
  415. router.get('/api/train/appAuth', controller.weixin.appAuth); // 微信登录
  416. // 微信端访问地址
  417. router.get('/api/train/authtest', controller.weixin.authTest); // 微信登录测试
  418. // pc端登录
  419. router.post('/api/train/login', controller.login.login); // 登录
  420. // 微信端登录
  421. router.get('/api/train/qrcode', controller.login.qrcode); // 登录
  422. router.post('/api/train/wxcheck', controller.login.wxcheck); // 微信检查登录
  423. router.post('/api/train/wxlogin', controller.login.wxlogin); // 登录
  424. // 评分表设置路由
  425. router.resources('score', '/api/train/score', controller.score); // index、create、show、destroy
  426. router.post('score', '/api/train/score/update/:id', controller.score.update);
  427. // 上传资料表设置路由
  428. router.resources('material', '/api/train/material', controller.material); // index、create、show、destroy
  429. router.post(
  430. 'material',
  431. '/api/train/material/update/:id',
  432. controller.material.update
  433. );
  434. // 资料评分表设置路由
  435. router.resources(
  436. 'materialscore',
  437. '/api/train/materialscore',
  438. controller.materialscore
  439. ); // index、create、show、destroy
  440. router.post(
  441. 'materialscore',
  442. '/api/train/materialscore/update/:id',
  443. controller.materialscore.update
  444. );
  445. // 教师在线表设置路由
  446. router.resources('online', '/api/train/online', controller.online); // index、create、show、destroy
  447. router.post(
  448. 'online',
  449. '/api/train/online/update/:id',
  450. controller.online.update
  451. );
  452. // 聊天房间表设置路由
  453. router.resources('room', '/api/train/room', controller.room); // index、create、show、destroy
  454. router.post('room', '/api/train/room/update/:id', controller.room.update);
  455. // 聊天记录表设置路由
  456. router.resources('record', '/api/train/record', controller.record); // index、create、show、destroy
  457. router.post(
  458. 'record',
  459. '/api/train/record/update/:id',
  460. controller.record.update
  461. );
  462. // 通知表设置路由
  463. router.resources('notice', '/api/train/notice', controller.notice); // index、create、show、destroy
  464. router.post(
  465. 'notice',
  466. '/api/train/notice/update/:id',
  467. controller.notice.update
  468. );
  469. router.post('notice', '/api/train/notice/look', controller.notice.look);
  470. router.post('notice', '/api/train/notice/resend', controller.notice.resend);
  471. // 课程模板表设置路由
  472. router.resources(
  473. 'lessonmode',
  474. '/api/train/lessonmode',
  475. controller.lessonmode
  476. ); // index、create、show、destroy
  477. router.post(
  478. 'lessonmode',
  479. '/api/train/lessonmode/update/:id',
  480. controller.lessonmode.update
  481. );
  482. // 全年计划模板表设置路由
  483. router.resources(
  484. 'trainmodel',
  485. '/api/train/trainmodel',
  486. controller.trainmodel
  487. ); // index、create、show、destroy
  488. router.post(
  489. 'trainmodel',
  490. '/api/train/trainmodel/update/:id',
  491. controller.trainmodel.update
  492. );
  493. // 统计查询设置路由
  494. router.get('/api/train/count/countstudent', controller.count.countstudent);
  495. // 按学校统计查询设置路由
  496. router.get('/api/train/count/countschstu/:id', controller.count.countschstu);
  497. // 班级类型表配置路由
  498. router.resources('classtype', '/api/train/classtype', controller.classtype); // index、create、show、destroy
  499. router.post(
  500. 'classtype',
  501. '/api/train/classtype/update/:id',
  502. controller.classtype.update
  503. );
  504. // 学校上传任务表设置路由
  505. router.resources('job', '/api/train/job', controller.job); // index、create、show、destroy
  506. router.post('job', '/api/train/job/update/:id', controller.job.update);
  507. // 消息表设置路由
  508. router.resources('message', '/api/train/message', controller.message); // index、create、show、destroy
  509. router.post(
  510. 'message',
  511. '/api/train/message/update/:id',
  512. controller.message.update
  513. );
  514. // 直播房间
  515. router.resources('liveroom', '/api/train/liveroom', controller.liveroom); // index、create、show、destroy
  516. router.post(
  517. 'liveroom',
  518. '/api/train/liveroom/update/:id',
  519. controller.liveroom.update
  520. );
  521. // 通知看直播
  522. router.post(
  523. 'liveroom',
  524. '/api/train/liveroom/sendmsg',
  525. controller.liveroom.sendmsg
  526. );
  527. // 监听人数
  528. router.post(
  529. 'liveroom',
  530. '/api/train/liveroom/personcount',
  531. controller.liveroom.personcount
  532. );
  533. // 培训视频
  534. router.resources(
  535. 'trainvideo',
  536. '/api/train/trainvideo',
  537. controller.trainvideo
  538. ); // index、create、show、destroy
  539. router.post(
  540. 'trainvideo',
  541. '/api/train/trainvideo/update/:id',
  542. controller.trainvideo.update
  543. );
  544. // 答疑申请(教师)
  545. router.resources('answerapply', '/api/train/answerapply', controller.answerapply); // index、create、show、destroy
  546. router.post(
  547. 'answerapply',
  548. '/api/train/answerapply/update/:id',
  549. controller.answerapply.update
  550. );
  551. // 答疑房间
  552. router.resources('chatroom', '/api/train/chatroom', controller.chatroom); // index、create、show、destroy
  553. router.post(
  554. 'chatroom',
  555. '/api/train/chatroom/update/:id',
  556. controller.chatroom.update
  557. );
  558. // 答疑对话
  559. router.resources(
  560. 'answerchat',
  561. '/api/train/answerchat',
  562. controller.answerchat
  563. ); // index、create、show、destroy
  564. router.post(
  565. 'answerchat',
  566. '/api/train/answerchat/update/:id',
  567. controller.answerchat.update
  568. );
  569. // 个人分groupscore
  570. router.resources(
  571. 'personalscore',
  572. '/api/train/personalscore',
  573. controller.personalscore
  574. ); // index、create、show、destroy
  575. router.post(
  576. 'personalscore',
  577. '/api/train/personalscore/update/:id',
  578. controller.personalscore.update
  579. );
  580. // 上分(混合操作,有添加,也有修改)
  581. router.post(
  582. 'personalscore',
  583. '/api/train/personalscore/opera',
  584. controller.personalscore.opera
  585. );
  586. router.resources(
  587. 'groupscore',
  588. '/api/train/groupscore',
  589. controller.groupscore
  590. ); // index、create、show、destroy
  591. router.post(
  592. 'groupscore',
  593. '/api/train/groupscore/update/:id',
  594. controller.groupscore.update
  595. );
  596. // 组上分(混合操作,有添加,也有修改)
  597. router.post(
  598. 'groupscore',
  599. '/api/train/groupscore/opera',
  600. controller.groupscore.opera
  601. );
  602. // 证书检验
  603. router.get('/api/train/cerconfirm', controller.cerconfirm.index);
  604. // 工具方法
  605. router.post('/api/train/util', controller.util.utilMethod);
  606. };