school.js 710 B

12345678910111213141516171819202122232425262728
  1. 'use strict';
  2. const _ = require('lodash');
  3. const meta = require('./.school.js');
  4. const Controller = require('egg').Controller;
  5. const { CrudController } = require('naf-framework-mongoose/lib/controller');
  6. // 学校管理
  7. class SchoolController extends Controller {
  8. constructor(ctx) {
  9. super(ctx);
  10. this.service = this.ctx.service.school;
  11. }
  12. // 学生名单上报
  13. async stuimport() {
  14. const res = await this.service.stuimport(this.ctx.request.body);
  15. this.ctx.ok({ msg: 'created', data: res });
  16. }
  17. async exportSchool() {
  18. const data = await this.service.exportSchool(this.ctx.request.body);
  19. this.ctx.ok({ data });
  20. }
  21. }
  22. module.exports = CrudController(SchoolController, meta);