pay.js 655 B

12345678910111213141516171819202122232425
  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. console.log(this.ctx.request);
  18. await this.service.callBackPayOrder(this.body);
  19. this.ctx.ok();
  20. }
  21. }
  22. module.exports = CrudController(PayController, {});