handle.js 952 B

1234567891011121314151617181920212223242526272829
  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. await 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.query);
  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. async exportsDownload() {
  24. const res = await this.ctx.service.handle.exportsDownload(this.ctx.query);
  25. this.ctx.body = res;
  26. }
  27. }
  28. module.exports = HandleController;