pay.js 632 B

123456789101112131415161718192021222324
  1. 'use strict';
  2. const Controller = require('egg').Controller;
  3. const { CrudController } = require('naf-framework-mongoose-free/lib/controller');
  4. //
  5. class PayController extends Controller {
  6. constructor(ctx) {
  7. super(ctx);
  8. this.service = this.ctx.service.trade.pay;
  9. this.body = this.ctx.request.body;
  10. this.query = this.ctx.query;
  11. }
  12. async toPayOrder() {
  13. const data = await this.service.toPayOrder(this.body);
  14. this.ctx.ok({ data });
  15. }
  16. async callBackPayOrder() {
  17. await this.service.callBackPayOrder(this.ctx.request.body);
  18. this.ctx.ok();
  19. }
  20. }
  21. module.exports = CrudController(PayController, {});