teacher.js 692 B

123456789101112131415161718192021222324252627282930
  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. module.exports = CrudController(TeacherController, meta);