router.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  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. router.resources('group', '/api/train/group', controller.group); // index、create、show、destroy
  308. router.post('group', '/api/train/group/update/:id', controller.group.update);
  309. router.post('group', '/api/train/group/insert', controller.group.insert);
  310. router.post('group', '/api/train/group/exit', controller.group.exit);
  311. router.post('group', '/api/train/group/sethead', controller.group.sethead);
  312. router.post(
  313. 'group',
  314. '/api/train/group/findbystuid',
  315. controller.group.findbystuid
  316. );
  317. // 职责说明表设置路由
  318. router.resources('duty', '/api/train/duty', controller.duty); // index、create、show、destroy
  319. router.post('duty', '/api/train/duty/update/:id', controller.duty.update);
  320. // 学生上传作业表设置路由
  321. router.resources(
  322. 'uploadtask',
  323. '/api/train/uploadtask',
  324. controller.uploadtask
  325. ); // index、create、show、destroy
  326. router.post(
  327. 'uploadtask',
  328. '/api/train/uploadtask/update/:id',
  329. controller.uploadtask.update
  330. );
  331. // 学生上传问卷表设置路由
  332. router.get(
  333. '/api/train/uploadquestion/completion',
  334. controller.uploadquestion.completion
  335. ); // 统计完成度
  336. router.resources(
  337. 'uploadquestion',
  338. '/api/train/uploadquestion',
  339. controller.uploadquestion
  340. ); // index、create、show、destroy
  341. router.post(
  342. 'uploadquestion',
  343. '/api/train/uploadquestion/update/:id',
  344. controller.uploadquestion.update
  345. );
  346. // 考勤表设置路由
  347. router.get('/api/train/attendance/wxauth', controller.attendance.wxauth); // 统计完成度
  348. router.resources(
  349. 'attendance',
  350. '/api/train/attendance',
  351. controller.attendance
  352. ); // index、create、show、destroy
  353. router.post(
  354. 'attendance',
  355. '/api/train/attendance/update/:id',
  356. controller.attendance.update
  357. );
  358. router.post(
  359. 'attendance',
  360. '/api/train/attendance/attendancecreate',
  361. controller.attendance.attendancecreate
  362. );
  363. router.post(
  364. 'attendance',
  365. '/api/train/attendance/attendancecreateList',
  366. controller.attendance.attendancecreateList
  367. );
  368. // 学校上传学生名单
  369. router.resources('school', '/api/train/school', controller.school); // index、create、show、destroy
  370. router.post(
  371. 'school',
  372. '/api/train/school/update/:id',
  373. controller.school.update
  374. );
  375. router.post('/api/train/school/import', controller.school.stuimport); // 名单上传
  376. // 民族表设置路由
  377. router.resources('nation', '/api/train/nation', controller.nation); // index、create、show、destroy
  378. router.post(
  379. 'nation',
  380. '/api/train/nation/update/:id',
  381. controller.nation.update
  382. );
  383. // 行政区划表设置路由
  384. router.resources('region', '/api/train/region', controller.region); // index、create、show、destroy
  385. router.post(
  386. 'region',
  387. '/api/train/region/update/:id',
  388. controller.region.update
  389. );
  390. // 用户表设置路由
  391. router.get('/api/train/user/schoolregister', controller.user.schoolregister); // 学校账号一键生成
  392. router.resources('user', '/api/train/user', controller.user); // index、create、show、destroy
  393. router.post('user', '/api/train/user/update/:id', controller.user.update);
  394. router.post('user', '/api/train/user/register', controller.user.register); // 学校注册
  395. router.post('user', '/api/train/user/bind', controller.user.bind); // 学生微信绑定
  396. router.post('user', '/api/train/user/userbind', controller.user.userbind); // 其他用户微信绑定
  397. router.post('user', '/api/train/user/appbind', controller.user.appbind); // 绑定小程序openid
  398. // 行政区划表设置路由
  399. router.resources('termquest', '/api/train/termquest', controller.termquest); // index、create、show、destroy
  400. router.post(
  401. 'termquest',
  402. '/api/train/termquest/update/:id',
  403. controller.termquest.update
  404. );
  405. // 微信端访问地址
  406. router.get('/api/train/auth', controller.weixin.auth); // 微信登录
  407. router.get('/api/train/appAuth', controller.weixin.appAuth); // 微信登录
  408. // 微信端访问地址
  409. router.get('/api/train/authtest', controller.weixin.authTest); // 微信登录测试
  410. // pc端登录
  411. router.post('/api/train/login', controller.login.login); // 登录
  412. // 微信端登录
  413. router.get('/api/train/qrcode', controller.login.qrcode); // 登录
  414. router.post('/api/train/wxcheck', controller.login.wxcheck); // 微信检查登录
  415. router.post('/api/train/wxlogin', controller.login.wxlogin); // 登录
  416. // 评分表设置路由
  417. router.resources('score', '/api/train/score', controller.score); // index、create、show、destroy
  418. router.post('score', '/api/train/score/update/:id', controller.score.update);
  419. // 上传资料表设置路由
  420. router.resources('material', '/api/train/material', controller.material); // index、create、show、destroy
  421. router.post(
  422. 'material',
  423. '/api/train/material/update/:id',
  424. controller.material.update
  425. );
  426. // 资料评分表设置路由
  427. router.resources(
  428. 'materialscore',
  429. '/api/train/materialscore',
  430. controller.materialscore
  431. ); // index、create、show、destroy
  432. router.post(
  433. 'materialscore',
  434. '/api/train/materialscore/update/:id',
  435. controller.materialscore.update
  436. );
  437. // 教师在线表设置路由
  438. router.resources('online', '/api/train/online', controller.online); // index、create、show、destroy
  439. router.post(
  440. 'online',
  441. '/api/train/online/update/:id',
  442. controller.online.update
  443. );
  444. // 聊天房间表设置路由
  445. router.resources('room', '/api/train/room', controller.room); // index、create、show、destroy
  446. router.post('room', '/api/train/room/update/:id', controller.room.update);
  447. // 聊天记录表设置路由
  448. router.resources('record', '/api/train/record', controller.record); // index、create、show、destroy
  449. router.post(
  450. 'record',
  451. '/api/train/record/update/:id',
  452. controller.record.update
  453. );
  454. // 通知表设置路由
  455. router.resources('notice', '/api/train/notice', controller.notice); // index、create、show、destroy
  456. router.post(
  457. 'notice',
  458. '/api/train/notice/update/:id',
  459. controller.notice.update
  460. );
  461. router.post('notice', '/api/train/notice/look', controller.notice.look);
  462. router.post('notice', '/api/train/notice/resend', controller.notice.resend);
  463. // 课程模板表设置路由
  464. router.resources(
  465. 'lessonmode',
  466. '/api/train/lessonmode',
  467. controller.lessonmode
  468. ); // index、create、show、destroy
  469. router.post(
  470. 'lessonmode',
  471. '/api/train/lessonmode/update/:id',
  472. controller.lessonmode.update
  473. );
  474. // 全年计划模板表设置路由
  475. router.resources(
  476. 'trainmodel',
  477. '/api/train/trainmodel',
  478. controller.trainmodel
  479. ); // index、create、show、destroy
  480. router.post(
  481. 'trainmodel',
  482. '/api/train/trainmodel/update/:id',
  483. controller.trainmodel.update
  484. );
  485. // 统计查询设置路由
  486. router.get('/api/train/count/countstudent', controller.count.countstudent);
  487. // 按学校统计查询设置路由
  488. router.get('/api/train/count/countschstu/:id', controller.count.countschstu);
  489. // 班级类型表配置路由
  490. router.resources('classtype', '/api/train/classtype', controller.classtype); // index、create、show、destroy
  491. router.post(
  492. 'classtype',
  493. '/api/train/classtype/update/:id',
  494. controller.classtype.update
  495. );
  496. // 学校上传任务表设置路由
  497. router.resources('job', '/api/train/job', controller.job); // index、create、show、destroy
  498. router.post('job', '/api/train/job/update/:id', controller.job.update);
  499. // 消息表设置路由
  500. router.resources('message', '/api/train/message', controller.message); // index、create、show、destroy
  501. router.post(
  502. 'message',
  503. '/api/train/message/update/:id',
  504. controller.message.update
  505. );
  506. // 直播房间
  507. router.resources('liveroom', '/api/train/liveroom', controller.liveroom); // index、create、show、destroy
  508. router.post(
  509. 'liveroom',
  510. '/api/train/liveroom/update/:id',
  511. controller.liveroom.update
  512. );
  513. // 通知看直播
  514. router.post(
  515. 'liveroom',
  516. '/api/train/liveroom/sendmsg',
  517. controller.liveroom.sendmsg
  518. );
  519. // 监听人数
  520. router.post(
  521. 'liveroom',
  522. '/api/train/liveroom/personcount',
  523. controller.liveroom.personcount
  524. );
  525. // 培训视频
  526. router.resources(
  527. 'trainvideo',
  528. '/api/train/trainvideo',
  529. controller.trainvideo
  530. ); // index、create、show、destroy
  531. router.post(
  532. 'trainvideo',
  533. '/api/train/trainvideo/update/:id',
  534. controller.trainvideo.update
  535. );
  536. // 答疑申请(教师)
  537. router.resources('answerapply', '/api/train/answerapply', controller.answerapply); // index、create、show、destroy
  538. router.post(
  539. 'answerapply',
  540. '/api/train/answerapply/update/:id',
  541. controller.answerapply.update
  542. );
  543. // 答疑房间
  544. router.resources('chatroom', '/api/train/chatroom', controller.chatroom); // index、create、show、destroy
  545. router.post(
  546. 'chatroom',
  547. '/api/train/chatroom/update/:id',
  548. controller.chatroom.update
  549. );
  550. // 答疑对话
  551. router.resources(
  552. 'answerchat',
  553. '/api/train/answerchat',
  554. controller.answerchat
  555. ); // index、create、show、destroy
  556. router.post(
  557. 'answerchat',
  558. '/api/train/answerchat/update/:id',
  559. controller.answerchat.update
  560. );
  561. // 个人分groupscore
  562. router.resources(
  563. 'personalscore',
  564. '/api/train/personalscore',
  565. controller.personalscore
  566. ); // index、create、show、destroy
  567. router.post(
  568. 'personalscore',
  569. '/api/train/personalscore/update/:id',
  570. controller.personalscore.update
  571. );
  572. // 上分(混合操作,有添加,也有修改)
  573. router.post(
  574. 'personalscore',
  575. '/api/train/personalscore/opera',
  576. controller.personalscore.opera
  577. );
  578. router.resources(
  579. 'groupscore',
  580. '/api/train/groupscore',
  581. controller.groupscore
  582. ); // index、create、show、destroy
  583. router.post(
  584. 'groupscore',
  585. '/api/train/groupscore/update/:id',
  586. controller.groupscore.update
  587. );
  588. // 组上分(混合操作,有添加,也有修改)
  589. router.post(
  590. 'groupscore',
  591. '/api/train/groupscore/opera',
  592. controller.groupscore.opera
  593. );
  594. // 证书检验
  595. router.get('/api/train/cerconfirm', controller.cerconfirm.index);
  596. // 工具方法
  597. router.post('/api/train/util', controller.util.utilMethod);
  598. };