router.js 20 KB

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