intercept.js 725 B

1234567891011121314151617181920212223242526272829
  1. 'use strict';
  2. const Controller = require('egg').Controller;
  3. const { CrudController } = require('naf-framework-mongoose/lib/controller');
  4. // 拦截
  5. class InterceptController extends Controller {
  6. constructor(ctx) {
  7. super(ctx);
  8. this.service = this.ctx.service.intercept;
  9. }
  10. async get() {
  11. const res = await this.service.getDeal();
  12. this.ctx.body = res;
  13. }
  14. async post() {
  15. const res = await this.service.postDeal();
  16. this.ctx.body = res;
  17. }
  18. async delete() {
  19. const res = await this.service.deleteDeal();
  20. this.ctx.body = res;
  21. }
  22. async freeWeb() {
  23. const res = await this.service.freeWebCount();
  24. this.ctx.body = res;
  25. }
  26. }
  27. module.exports = CrudController(InterceptController, {});