123456789101112131415161718192021222324252627282930313233343536373839404142 |
- 'use strict';
- const Controller = require('egg').Controller;
- const { CrudController } = require('naf-framework-mongoose-free/lib/controller');
- const { BusinessError, ErrorCode } = require('naf-core').Error;
- const _ = require('lodash');
- const moment = require('moment');
- // 业务工具
- 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 util() {
- console.log('line 18 in function:');
- this.ctx.ok();
- }
- async crk() {
- const key = await this.ctx.service.util.rk.crk();
- this.ctx.ok({ data: key });
- }
- /**
- * 查询是否可以购买
- */
- 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, {});
|