|
@@ -129,24 +129,11 @@ export class KycService extends BaseService {
|
|
data.level = +kyc.level + 1;
|
|
data.level = +kyc.level + 1;
|
|
data.customerId = kyc.customerId
|
|
data.customerId = kyc.customerId
|
|
}
|
|
}
|
|
- if (data.level > 3) {
|
|
|
|
- data.payUrl = await this.validAndGetPayUrl(orderNo, data);
|
|
|
|
- return data;
|
|
|
|
- }
|
|
|
|
- const dailyLevel = this.getAmountLevel(order.amount, order.currency);
|
|
|
|
- if (dailyLevel === 3) {
|
|
|
|
- data.levelEnd = dailyLevel;
|
|
|
|
- data.payUrl = await this.validAndGetPayUrl(orderNo, data);
|
|
|
|
- return data;
|
|
|
|
- }
|
|
|
|
|
|
+ const daily = await this.getDailyLevel(order, order.currency);
|
|
const weekly = await this.getWeekLyLevel(order, order.currency);
|
|
const weekly = await this.getWeekLyLevel(order, order.currency);
|
|
- if (weekly === 3) {
|
|
|
|
- data.levelEnd = dailyLevel;
|
|
|
|
- data.payUrl = await this.validAndGetPayUrl(orderNo, data);
|
|
|
|
- return data;
|
|
|
|
- }
|
|
|
|
const monthly = await this.getMonthlyLevel(order, order.currency);
|
|
const monthly = await this.getMonthlyLevel(order, order.currency);
|
|
- data.levelEnd = Math.max(dailyLevel, weekly, monthly);
|
|
|
|
|
|
+ data.levelEnd = Math.max(daily, weekly, monthly);
|
|
|
|
+ console.log('---------', daily, weekly, monthly, data.level, data.levelEnd, data.customerId)
|
|
data.payUrl = await this.validAndGetPayUrl(orderNo, data);
|
|
data.payUrl = await this.validAndGetPayUrl(orderNo, data);
|
|
return data;
|
|
return data;
|
|
}
|
|
}
|
|
@@ -159,6 +146,7 @@ export class KycService extends BaseService {
|
|
});
|
|
});
|
|
return payUrl;
|
|
return payUrl;
|
|
} catch (e) {
|
|
} catch (e) {
|
|
|
|
+ console.log('----发起订单失败-----')
|
|
return "";
|
|
return "";
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@@ -166,6 +154,15 @@ export class KycService extends BaseService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ async getDailyLevel(order, currency) {
|
|
|
|
+ const daily = await this.orderService.getDailyAmount(order.mchId, order.userId, order.code);
|
|
|
|
+ let amount = 0;
|
|
|
|
+ if (daily && daily[0]) {
|
|
|
|
+ amount = +daily[0].total;
|
|
|
|
+ }
|
|
|
|
+ return this.getAmountLevel(amount + +order.amount, currency);
|
|
|
|
+ }
|
|
|
|
+
|
|
async getMonthlyLevel(order, currency) {
|
|
async getMonthlyLevel(order, currency) {
|
|
const month = await this.orderService.getMonthlyAmount(order.mchId, order.userId, order.code);
|
|
const month = await this.orderService.getMonthlyAmount(order.mchId, order.userId, order.code);
|
|
let amount = 0;
|
|
let amount = 0;
|
|
@@ -186,7 +183,7 @@ export class KycService extends BaseService {
|
|
|
|
|
|
getAmountLevel(amount: number, currency) {
|
|
getAmountLevel(amount: number, currency) {
|
|
const eur = this.toEur(amount, currency)
|
|
const eur = this.toEur(amount, currency)
|
|
- console.log('-----------------------', eur)
|
|
|
|
|
|
+ console.log('转换为欧元:', amount, eur)
|
|
if (eur <= 1000) {
|
|
if (eur <= 1000) {
|
|
return 1;
|
|
return 1;
|
|
} else if (eur <= 5000) {
|
|
} else if (eur <= 5000) {
|