router.js 20 KB

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