|
@@ -296,7 +296,12 @@ class WithdrawService
|
|
|
|
|
|
|
|
$wallet = Wallet::where('member_id', $chatId)->first();
|
|
$wallet = Wallet::where('member_id', $chatId)->first();
|
|
|
$temp = floatval($wallet->available_balance);
|
|
$temp = floatval($wallet->available_balance);
|
|
|
- if ($amount > $temp) {
|
|
|
|
|
|
|
+ // 汇率
|
|
|
|
|
+ $rate = Config::where('field', 'exchange_rate_rmb')->first()->val??1;
|
|
|
|
|
+ $rate_usdt_amount = bcdiv($temp, $rate, 2); // 钱包可用余额 折合USDT
|
|
|
|
|
+
|
|
|
|
|
+ $rate_rmb_amount = bcmul($amount, $rate, 2); // 提现金额 折合RMB
|
|
|
|
|
+ if ($amount > $rate_usdt_amount) {
|
|
|
return [
|
|
return [
|
|
|
'chat_id' => $chatId,
|
|
'chat_id' => $chatId,
|
|
|
'text' => "⚠️可用余额不足,请重试",
|
|
'text' => "⚠️可用余额不足,请重试",
|
|
@@ -325,10 +330,10 @@ class WithdrawService
|
|
|
$wallet = Wallet::where('member_id', $chatId)->first();
|
|
$wallet = Wallet::where('member_id', $chatId)->first();
|
|
|
$bl = new BalanceLog();
|
|
$bl = new BalanceLog();
|
|
|
$bl->member_id = $chatId;
|
|
$bl->member_id = $chatId;
|
|
|
- $bl->amount = $amount * -1;
|
|
|
|
|
|
|
+ $bl->amount = bcmul(($amount * -1),$rate,10); // 扣除的金额 RMB
|
|
|
$bl->before_balance = $wallet->available_balance;
|
|
$bl->before_balance = $wallet->available_balance;
|
|
|
|
|
|
|
|
- $wallet->available_balance = bcsub($wallet->available_balance, $amount, 10);
|
|
|
|
|
|
|
+ $wallet->available_balance = bcsub($wallet->available_balance, $rate_rmb_amount, 10);
|
|
|
$wallet->save();
|
|
$wallet->save();
|
|
|
$bl->after_balance = $wallet->available_balance;
|
|
$bl->after_balance = $wallet->available_balance;
|
|
|
$bl->change_type = '提现';
|
|
$bl->change_type = '提现';
|
|
@@ -348,7 +353,9 @@ class WithdrawService
|
|
|
|
|
|
|
|
$temp = floatval($wallet->available_balance);
|
|
$temp = floatval($wallet->available_balance);
|
|
|
$text = "✅ 提现申请已提交!\n\n";
|
|
$text = "✅ 提现申请已提交!\n\n";
|
|
|
- $text .= "钱包余额:{$temp} USDT\n";
|
|
|
|
|
|
|
+ $text .= "钱包余额:{$temp} RMB\n";
|
|
|
|
|
+ $text .= "汇率:1 USDT = {$rate} RMB\n";
|
|
|
|
|
+ $text .= "剩余可用USDT余额:".number_format(bcdiv($temp, $rate, 2), 2)." USDT\n";
|
|
|
$text .= "提现金额:{$amount} USDT\n";
|
|
$text .= "提现金额:{$amount} USDT\n";
|
|
|
$text .= "实际到账:{$real} USDT\n";
|
|
$text .= "实际到账:{$real} USDT\n";
|
|
|
$text .= "手续费:{$serviceCharge} USDT\n\n";
|
|
$text .= "手续费:{$serviceCharge} USDT\n\n";
|
|
@@ -410,6 +417,9 @@ class WithdrawService
|
|
|
}
|
|
}
|
|
|
$wallet = Wallet::where('member_id', $chatId)->first();
|
|
$wallet = Wallet::where('member_id', $chatId)->first();
|
|
|
$temp = floatval($wallet->available_balance);
|
|
$temp = floatval($wallet->available_balance);
|
|
|
|
|
+ // 汇率
|
|
|
|
|
+ $rate = Config::where('field', 'exchange_rate_rmb')->first()->val??1;
|
|
|
|
|
+ $rate_amount = bcdiv($temp, $rate, 2);
|
|
|
if ($amount <= $this->serviceCharge) {
|
|
if ($amount <= $this->serviceCharge) {
|
|
|
return [[
|
|
return [[
|
|
|
'chat_id' => $chatId,
|
|
'chat_id' => $chatId,
|
|
@@ -417,7 +427,7 @@ class WithdrawService
|
|
|
'reply_to_message_id' => $messageId
|
|
'reply_to_message_id' => $messageId
|
|
|
]];
|
|
]];
|
|
|
}
|
|
}
|
|
|
- if ($amount > $temp) {
|
|
|
|
|
|
|
+ if ($amount > $rate_amount) {
|
|
|
return [[
|
|
return [[
|
|
|
'chat_id' => $chatId,
|
|
'chat_id' => $chatId,
|
|
|
'text' => "⚠️可用余额不足,请重试",
|
|
'text' => "⚠️可用余额不足,请重试",
|