1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- import { CoolController, BaseController } from '@cool-midway/core';
- import { ALL, Body, Get, Inject, Post, Provide,Query,Param } from '@midwayjs/decorator';
- import { BusinessEntity } from '../../payment/entity/business';
- import { OrderService } from "../../payment/service/order";
- /**
- * 入金
- */
- @Provide()
- @CoolController('/api/v1/Fiat')
- export class PayInController extends BaseController {
- @Inject()
- orderService: OrderService;
- /**
- * 创建订单
- * /api/v3/Fiat/PayIn
- */
- @Post('/PayIn', { summary: '创建订单' })
- async createPayInOrder(@Body(ALL) business: BusinessEntity) {
- // if (!this.allowKeys.includes(key)) {
- // return this.fail('非法操作');
- // }
- // 关键参数校验
- // 数据落库
- // 回调
- console.log('createPayInOrder-=-=payIn-=-=000',business);
- return this.ok(await this.orderService.recharge(business));
- }
- /**
- * 查询订单
- * /api/v3/Fiat/PayIn/{orderNo}
- */
- @Get('/PayIn/', { summary: '查询订单' })
- async getPayInForOrderNo(@Query('orderNo') orderNo: string,) {
- // if (!this.allowKeys.includes(key)) {
- // return this.fail('非法操作');
- // }
- // 关键参数校验
- // 数据落库
- // 回调
- console.log('getPayInForOrderNo-=-=-=-111',orderNo);
- return this.ok(await this.orderService.rechargeOrder({ orderNo: orderNo,channel:'SUNPAY'}));
- }
- /**
- * 取消订单
- * /api/v3/Fiat/PayIn/{orderNo}/Cancel
- */
- @Post('/PayIn/:orderNo/Cancel', { summary: '取消订单' })
- async cancelPayInOrderForOrderNo(@Param('orderNo') orderNo: string) {
- // if (!this.allowKeys.includes(key)) {
- // return this.fail('非法操作');
- // }
- // 关键参数校验
- // 数据落库
- // 回调
- console.log('cancelPayInOrderForOrderNo-=-=-=111',orderNo);
- return this.ok(await this.orderService.rechargeOrderCancel({orderNo:orderNo}));
- }
- }
|