12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- '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() {
- // await this.ctx.service.util.rabbitMq.shopMsg('6333d71d32c5f69745f9bd32');
- this.ctx.ok({ data: '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 });
- }
- async getGroup() {
- this.ctx.ok();
- }
- }
- module.exports = CrudController(UtilController, {});
|