type.js 638 B

123456789101112131415161718192021222324
  1. 'use strict';
  2. const Controller = require('egg').Controller;
  3. class TypeController extends Controller {
  4. async create() {
  5. const res = await this.ctx.service.type.create(this.ctx.request.body);
  6. this.ctx.body = res;
  7. }
  8. async update() {
  9. const res = await this.ctx.service.type.update(this.ctx.request.body);
  10. this.ctx.body = res;
  11. }
  12. async delete() {
  13. console.log(123);
  14. const res = await this.ctx.service.type.delete(this.ctx.params);
  15. this.ctx.body = res;
  16. }
  17. async query() {
  18. const res = await this.ctx.service.type.query(this.ctx.query);
  19. this.ctx.body = res;
  20. }
  21. }
  22. module.exports = TypeController;