Ken 2 ay önce
ebeveyn
işleme
255bf74e36

+ 6 - 0
app/Http/Controllers/api/TelegramWebHook.php

@@ -900,6 +900,12 @@ class TelegramWebHook extends Controller
                     $telegram->editMessageText($res);
                 }
 
+                //钱宝提现
+                if($data === 'withdraw@@qbApply'){
+                    $res =  WithdrawService::qbApply($chatId,$messageId);
+                    $telegram->editMessageText($res);
+                }
+
                 //地址管理
                 if ($data === 'withdraw@@address') {
                     $res = WithdrawService::getAddress($chatId, $messageId);

+ 17 - 6
app/Services/WithdrawService.php

@@ -297,7 +297,7 @@ class WithdrawService
         $wallet = Wallet::where('member_id', $chatId)->first();
         $temp = floatval($wallet->available_balance);
         // 汇率
-        $rate = Config::where('field', 'exchange_rate_rmb')->first()->val??1;
+        $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
@@ -330,7 +330,7 @@ class WithdrawService
         $wallet = Wallet::where('member_id', $chatId)->first();
         $bl = new BalanceLog();
         $bl->member_id = $chatId;
-        $bl->amount = bcmul(($amount * -1),$rate,10); // 扣除的金额 RMB
+        $bl->amount = bcmul(($amount * -1), $rate, 10); // 扣除的金额 RMB
         $bl->before_balance = $wallet->available_balance;
 
         $wallet->available_balance = bcsub($wallet->available_balance, $rate_rmb_amount, 10);
@@ -347,7 +347,7 @@ class WithdrawService
         $withdraw->address = $address;
         $withdraw->exchange_rate = $rate;
         $withdraw->status = 0;
-        $withdraw->after_balance = bcdiv($wallet->available_balance,$rate,2);
+        $withdraw->after_balance = bcdiv($wallet->available_balance, $rate, 2);
         $withdraw->save();
         $bl->related_id = $withdraw->id;
         $bl->save();
@@ -356,7 +356,7 @@ class WithdrawService
         $text = "✅ 提现申请已提交!\n\n";
         $text .= "钱包余额:{$temp} RMB\n";
         $text .= "汇率:1 USDT = {$rate} RMB\n";
-        $text .= "剩余可用USDT余额:".number_format(bcdiv($temp, $rate, 2), 2)." USDT\n";
+        $text .= "剩余可用USDT余额:" . number_format(bcdiv($temp, $rate, 2), 2) . " USDT\n";
         $text .= "提现金额:{$amount} USDT\n";
         $text .= "实际到账:{$real} USDT\n";
         $text .= "手续费:{$serviceCharge} USDT\n\n";
@@ -419,7 +419,7 @@ class WithdrawService
         $wallet = Wallet::where('member_id', $chatId)->first();
         $temp = floatval($wallet->available_balance);
         // 汇率
-        $rate = Config::where('field', 'exchange_rate_rmb')->first()->val??1;
+        $rate = Config::where('field', 'exchange_rate_rmb')->first()->val ?? 1;
         $rate_amount = bcdiv($temp, $rate, 2);
         if ($amount <= $this->serviceCharge) {
             return [[
@@ -474,12 +474,23 @@ class WithdrawService
         ]];
     }
 
+    //钱宝提现
+    static function qbApply($chatId, $messageId)
+    {
+        return [
+
+            'chat_id' => $chatId,
+            'text' => '你好啊',
+            'message_id' => $messageId,
+        ];
+    }
+
     //申请提现
     public function apply($chatId, $messageId)
     {
         $wallet = Wallet::where('member_id', $chatId)->first();
         // 汇率
-        $rate = Config::where('field', 'exchange_rate_rmb')->first()->val??1;
+        $rate = Config::where('field', 'exchange_rate_rmb')->first()->val ?? 1;
         $temp = floatval($wallet->available_balance);
         $amount = bcdiv($temp, $rate, 2);
         $text = "请发送提现金额\n";