class.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 upclasses() {
  33. const res = await this.service.upclasses(this.ctx.request.body);
  34. this.ctx.ok({ msg: 'ok', data: res });
  35. }
  36. async classinfo() {
  37. const res = await this.service.classinfo(this.ctx.params);
  38. this.ctx.ok({ msg: 'ok', data: res });
  39. }
  40. }
  41. module.exports = CrudController(ClassController, meta);