util.js 689 B

1234567891011121314151617181920212223242526
  1. 'use strict';
  2. const Controller = require('egg').Controller;
  3. class UtilController extends Controller {
  4. constructor(ctx) {
  5. super(ctx);
  6. this.service = this.ctx.service.util;
  7. }
  8. async utilMethod() {
  9. const res = await this.service.utilMethod(this.ctx.query, this.ctx.request.body);
  10. this.ctx.ok({ data: res });
  11. }
  12. // 导出学校计划人数
  13. async schoolDownload() {
  14. const data = await this.service.schoolDownload();
  15. this.ctx.ok({ data });
  16. }
  17. // 导入学校计划人数
  18. async schoolImport() {
  19. const res = await this.service.schoolImport(this.ctx.request.body);
  20. this.ctx.ok({ msg: 'created', data: res });
  21. }
  22. }
  23. module.exports = UtilController;