teacher.js 860 B

123456789101112131415161718192021222324252627282930313233343536
  1. 'use strict';
  2. const _ = require('lodash');
  3. const Controller = require('egg').Controller;
  4. const meta = require('./.teacher.js');
  5. const { CrudController } = require('naf-framework-mongoose/lib/controller');
  6. // 老师管理
  7. class TeacherController extends Controller {
  8. constructor(ctx) {
  9. super(ctx);
  10. this.service = this.ctx.service.teacher;
  11. }
  12. // GET
  13. // 查询教师详情
  14. async show() {
  15. const res = await this.service.fetchTeacher(this.ctx.params);
  16. this.ctx.ok({ data: res });
  17. }
  18. async status() {
  19. const res = await this.service.status(this.ctx.request.body);
  20. this.ctx.ok({ data: res });
  21. }
  22. // 教师评分上报
  23. async teaimport() {
  24. const res = await this.service.teaimport(this.ctx.request.body);
  25. this.ctx.ok({ msg: 'created', data: res });
  26. }
  27. }
  28. module.exports = CrudController(TeacherController, meta);