|
@@ -824,7 +824,29 @@ async function generateBillMessage(chatId) {
|
|
if (todayRecords && todayRecords.length > 0) {
|
|
if (todayRecords && todayRecords.length > 0) {
|
|
message += `<b>入款笔数</b>:<code>${todayRecords.length}</code>(最近记录)\n`;
|
|
message += `<b>入款笔数</b>:<code>${todayRecords.length}</code>(最近记录)\n`;
|
|
todayRecords.forEach(deposit => {
|
|
todayRecords.forEach(deposit => {
|
|
- message += `<code>${moment(deposit.time).format('HH:mm:ss')} ${parseFloat(deposit.amount).toFixed(2)}</code>\n`;
|
|
|
|
|
|
+ const amount = parseFloat(deposit.amount);
|
|
|
|
+ const exchangeRate = parseFloat(deposit.exchange_rate) || 1;
|
|
|
|
+ const feeRate = parseFloat(deposit.fee_rate) || 0;
|
|
|
|
+
|
|
|
|
+ // 计算实际金额(扣除费率)
|
|
|
|
+ let actualAmount;
|
|
|
|
+ if (amount > 0) {
|
|
|
|
+ // 入款:实际金额 = 金额 * (1 - 费率)
|
|
|
|
+ actualAmount = Math.abs(amount) * (1 - feeRate / 100);
|
|
|
|
+ } else {
|
|
|
|
+ // 入款修正:实际金额 = 金额 * (1 - 费率)
|
|
|
|
+ actualAmount = Math.abs(amount) * (1 - feeRate / 100);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 计算USDT金额
|
|
|
|
+ const uAmount = (actualAmount / exchangeRate) * (amount < 0 ? -1 : 1);
|
|
|
|
+
|
|
|
|
+ // 显示计算过程
|
|
|
|
+ const feeAmount = Math.abs(amount) * (feeRate / 100);
|
|
|
|
+ const feeDisplay = feeRate > 0 ? `-${feeAmount.toFixed(2)}(${feeRate}%)` : '';
|
|
|
|
+ const exchangeDisplay = exchangeRate !== 1 ? `÷${exchangeRate}` : '';
|
|
|
|
+
|
|
|
|
+ message += `<code>${moment(deposit.time).format('HH:mm:ss')} ${parseFloat(deposit.amount).toFixed(2)}${feeDisplay}${exchangeDisplay} = ${uAmount.toFixed(2)}U</code>\n`;
|
|
});
|
|
});
|
|
message += '\n';
|
|
message += '\n';
|
|
} else {
|
|
} else {
|