123456789101112131415161718192021222324252627 |
- 'use strict';
- const Controller = require('egg').Controller;
- const { CrudController } = require('naf-framework-mongoose-free/lib/controller');
- // 业务工具
- class UtilController extends Controller {
- constructor(ctx) {
- super(ctx);
- this.queryObject = this.ctx.query;
- this.bodyObject = this.ctx.request.body;
- this.service = this.ctx.service.util;
- this.tradeService = this.ctx.service.util.trade;
- }
- /**
- * 查询是否可以购买
- */
- async checkCanBuy() {
- const data = await this.tradeService.checkCanBuy(this.bodyObject);
- this.ctx.ok({ data });
- }
- async checkCartBuy() {
- const data = await this.tradeService.checkCartBuy(this.bodyObject);
- this.ctx.ok({ data });
- }
- }
- module.exports = CrudController(UtilController, {});
|