router.js 21 KB

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