|
@@ -1,6 +1,7 @@
|
|
import { CoolController, BaseController } from '@cool-midway/core';
|
|
import { CoolController, BaseController } from '@cool-midway/core';
|
|
-import { ALL, Body, Get, Inject, Post, Provide } from '@midwayjs/decorator';
|
|
|
|
|
|
+import { ALL, Body, Get, Inject, Post, Provide, Query } from '@midwayjs/decorator';
|
|
import { BusinessEntity } from '../../payment/entity/business';
|
|
import { BusinessEntity } from '../../payment/entity/business';
|
|
|
|
+import { WalletService } from "../../payment/service/wallet";
|
|
|
|
|
|
/**
|
|
/**
|
|
* 钱包
|
|
* 钱包
|
|
@@ -8,6 +9,8 @@ import { BusinessEntity } from '../../payment/entity/business';
|
|
@Provide()
|
|
@Provide()
|
|
@CoolController('/api/v1/Fiat')
|
|
@CoolController('/api/v1/Fiat')
|
|
export class WalletController extends BaseController {
|
|
export class WalletController extends BaseController {
|
|
|
|
+ @Inject()
|
|
|
|
+ walletService: WalletService;
|
|
/**
|
|
/**
|
|
* 创建钱包
|
|
* 创建钱包
|
|
* /api/v3/Fiat/Wallet
|
|
* /api/v3/Fiat/Wallet
|
|
@@ -21,7 +24,7 @@ export class WalletController extends BaseController {
|
|
// 数据落库
|
|
// 数据落库
|
|
// 回调
|
|
// 回调
|
|
console.log(business);
|
|
console.log(business);
|
|
- return this.ok('hello, cool-admin!!!');
|
|
|
|
|
|
+ return this.ok(await this.walletService.add(business));
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
* TODO 创建钱包回调通知
|
|
* TODO 创建钱包回调通知
|
|
@@ -43,29 +46,34 @@ export class WalletController extends BaseController {
|
|
*
|
|
*
|
|
*/
|
|
*/
|
|
@Get('/GetWalletAccounts', { summary: '获取钱包信息' })
|
|
@Get('/GetWalletAccounts', { summary: '获取钱包信息' })
|
|
- async GetWalletAccounts(@Body(ALL) business: BusinessEntity) {
|
|
|
|
|
|
+ async GetWalletAccounts(@Query('customer_id') customer_id: string,) {
|
|
// if (!this.allowKeys.includes(key)) {
|
|
// if (!this.allowKeys.includes(key)) {
|
|
// return this.fail('非法操作');
|
|
// return this.fail('非法操作');
|
|
// }
|
|
// }
|
|
// 关键参数校验
|
|
// 关键参数校验
|
|
// 数据落库
|
|
// 数据落库
|
|
// 回调
|
|
// 回调
|
|
- console.log(business);
|
|
|
|
- return this.ok('hello, cool-admin!!!');
|
|
|
|
|
|
+ console.log('GetWalletAccounts', customer_id);
|
|
|
|
+ return this.ok(await this.walletService.getWallet(customer_id));
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取账户币种余额
|
|
* 获取账户币种余额
|
|
*/
|
|
*/
|
|
@Get('/AccountBalance', { summary: '获取账户币种余额' })
|
|
@Get('/AccountBalance', { summary: '获取账户币种余额' })
|
|
- async AccountBalance(@Body(ALL) business: BusinessEntity) {
|
|
|
|
|
|
+ async AccountBalance(
|
|
|
|
+ @Query('customer_id') customer_id: string,
|
|
|
|
+ @Query('currency') currency: string,) {
|
|
// if (!this.allowKeys.includes(key)) {
|
|
// if (!this.allowKeys.includes(key)) {
|
|
// return this.fail('非法操作');
|
|
// return this.fail('非法操作');
|
|
// }
|
|
// }
|
|
// 关键参数校验
|
|
// 关键参数校验
|
|
// 数据落库
|
|
// 数据落库
|
|
// 回调
|
|
// 回调
|
|
- console.log(business);
|
|
|
|
- return this.ok('hello, cool-admin!!!');
|
|
|
|
|
|
+ console.log(customer_id,currency);
|
|
|
|
+ return this.ok(await this.walletService.getWalletBalance({
|
|
|
|
+ customer_id: customer_id,
|
|
|
|
+ currency: currency
|
|
|
|
+ }));
|
|
}
|
|
}
|
|
}
|
|
}
|