handle.js 811 B

12345678910111213141516171819202122232425
  1. 'use strict';
  2. const Controller = require('egg').Controller;
  3. const { v4: uuidv4 } = require('uuid');
  4. class HandleController extends Controller {
  5. async import() {
  6. const taskId = uuidv4();
  7. this.ctx.service.handle.import({ ...this.ctx.params, taskId });
  8. this.ctx.body = { errcode: 0, errmsg: '', data: [], taskId };
  9. }
  10. async export() {
  11. const taskId = uuidv4();
  12. this.ctx.service.handle.export({ ...this.ctx.request.body, taskId });
  13. this.ctx.body = { errcode: 0, errmsg: '', data: [], taskId };
  14. }
  15. async progressed() {
  16. const res = await this.ctx.service.progress.progressed(this.ctx.params);
  17. this.ctx.body = res;
  18. }
  19. async template() {
  20. const res = await this.ctx.service.handle.template(this.ctx.query);
  21. this.ctx.body = res;
  22. }
  23. }
  24. module.exports = HandleController;