class.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. 'use strict';
  2. const _ = require('lodash');
  3. const meta = require('./.class.js');
  4. const Controller = require('egg').Controller;
  5. const { CrudController } = require('naf-framework-mongoose/lib/controller');
  6. // 班级管理
  7. class ClassController extends Controller {
  8. constructor(ctx) {
  9. super(ctx);
  10. this.service = this.ctx.service.class;
  11. }
  12. async divide() {
  13. const res = await this.service.divide(this.ctx.request.body);
  14. this.ctx.ok({ data: res });
  15. }
  16. async notice() {
  17. const res = await this.service.notice(this.ctx.request.body);
  18. this.ctx.ok({ data: res });
  19. }
  20. async uptea() {
  21. const res = await this.service.uptea(this.ctx.request.body);
  22. this.ctx.ok({ data: res });
  23. }
  24. // 根据班级id与学生id修改学生班级
  25. async studentupclass() {
  26. const res = await this.service.studentupclass(
  27. this.ctx.params,
  28. this.ctx.request.body
  29. );
  30. this.ctx.ok({ data: res });
  31. }
  32. async searchDate() {
  33. const res = await this.service.searchDate(this.ctx.query);
  34. this.ctx.ok({ data: res });
  35. }
  36. }
  37. module.exports = CrudController(ClassController, meta);