router.js 20 KB

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