|
@@ -32,16 +32,8 @@ export class PayeeAddressService extends BaseService {
|
|
|
* @returns
|
|
|
*/
|
|
|
async add(params: any) {
|
|
|
- let merchantId;
|
|
|
- const isOpenApi = params.hasOwnProperty('isOpenApi')
|
|
|
- ? params.isOpenApi
|
|
|
- : false;
|
|
|
- if (isOpenApi) {
|
|
|
- merchantId = params.out_user_id;
|
|
|
- } else {
|
|
|
- const { merchant } = this.ctx.admin;
|
|
|
- merchantId = merchant.id;
|
|
|
- }
|
|
|
+ const { merchant } = this.ctx.admin;
|
|
|
+ const merchantId = merchant.mchId;
|
|
|
if (!['TRC20', 'ERC20'].includes(params.currency)) {
|
|
|
const res = await this.paymentService
|
|
|
.setChannel(params.channel)
|
|
@@ -80,16 +72,8 @@ export class PayeeAddressService extends BaseService {
|
|
|
}
|
|
|
async list(params: any, option: any, connectionName?: any) {
|
|
|
const { channel, currency } = params;
|
|
|
- let merchantId;
|
|
|
- const isOpenApi = params.hasOwnProperty('isOpenApi')
|
|
|
- ? params.isOpenApi
|
|
|
- : false;
|
|
|
- if (isOpenApi) {
|
|
|
- merchantId = params.out_user_id;
|
|
|
- } else {
|
|
|
- const { merchant } = this.ctx.admin;
|
|
|
- merchantId = merchant.id;
|
|
|
- }
|
|
|
+ const { merchant } = this.ctx.admin;
|
|
|
+ const merchantId = merchant.mchId;
|
|
|
const res = await this.payeeAddressEntity.find({
|
|
|
where: {
|
|
|
merchantId: merchantId,
|
|
@@ -101,21 +85,9 @@ export class PayeeAddressService extends BaseService {
|
|
|
return res;
|
|
|
}
|
|
|
async page(params: any) {
|
|
|
- const merchantId = await this.getMerchantId(params);
|
|
|
+ const { merchant } = this.ctx.admin;
|
|
|
+ const merchantId = merchant.mchId;
|
|
|
const query = `SELECT * FROM payee WHERE merchantId = '${merchantId}' ORDER BY merchantId ASC`;
|
|
|
return this.sqlRenderPage(query, params, false);
|
|
|
}
|
|
|
-
|
|
|
- async getMerchantId(params) {
|
|
|
- let merchantId;
|
|
|
- if (this._isOpenApi) {
|
|
|
- merchantId = params.out_user_id;
|
|
|
- } else if (params?.mch_id || params?.mchId) {
|
|
|
- merchantId = params?.mch_id || params?.mchId
|
|
|
- } else {
|
|
|
- const { merchant } = this.ctx.admin;
|
|
|
- merchantId = merchant.mchId;
|
|
|
- }
|
|
|
- return merchantId
|
|
|
- }
|
|
|
}
|