Ken 4 месяцев назад
Родитель
Сommit
bc85762aab

+ 1 - 0
app/Constants/StepStatus.php

@@ -29,6 +29,7 @@ class StepStatus
 
     const INPUT_WITHDRAW_QB_MONEY = 16;//输入 钱宝提现金额
     const CHOOSE_WITHDRAW_QB_ADDRESS = 17;//选择 提现卡号
+    const QB_INPUT_BANK_NAME = 18;//输入 银行名称
 
 
 }

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

@@ -631,6 +631,9 @@ class TelegramWebHook extends Controller
                                 $res = QianBaoWithdrawService::inputQbAmount($chatId, $text, $messageId);
                                 return $res;
                                 break;
+                            case StepStatus::QB_INPUT_BANK_NAME:
+                                $res = QianBaoWithdrawService::inputBankName($chatId, $text, $messageId);
+                                return $res;
                             case StepStatus::INPUT_ADDRESS_TRC20:
                                 $res = WithdrawService::inputAddress($chatId, $text, $messageId);
                                 return $res;

+ 49 - 1
app/Services/QianBaoWithdrawService.php

@@ -53,6 +53,14 @@ class QianBaoWithdrawService
             $res = QianBaoWithdrawService::addBank($chatId, $messageId);
             $telegram->editMessageText($res);
         }
+        $pattern = "/^withdrawAddress@@bank_choose_channel_.*$/";
+        if (preg_match($pattern, $data)) {
+            $channel = preg_replace('/^withdrawAddress@@bank_choose_channel_/', '', $data);
+            $res = static::chooseChannel($chatId, $messageId, $channel);
+            $telegram->editMessageText($res);
+        }
+
+
     }
 
 
@@ -197,7 +205,6 @@ class QianBaoWithdrawService
                 ['text' => '❌取消', 'callback_data' => "message@@close"]
             ]
         ];
-
         return [
             'chat_id' => $chatId,
             'text' => $text,
@@ -206,5 +213,46 @@ class QianBaoWithdrawService
         ];
     }
 
+    static function chooseChannel($chatId, $messageId, $channel)
+    {
+        Cache::put("{$chatId}_QB_WITHDRAW_CHANNEL", $channel);
+
+        switch ($channel) {
+            case "DF002"://支付宝
+                Cache::put("{$chatId}_QB_WITHDRAW_BANK_NAME", '支付宝');
+                return [
+                    'chat_id' => $chatId,
+                    'text' => "请输入支付宝账号",
+                    'message_id' => $messageId,
+                ];
+                break;
+            case "DF001"://银行卡
+                Cache::put(get_step_key($chatId), StepStatus::QB_INPUT_BANK_NAME);
+                return [
+                    'chat_id' => $chatId,
+                    'text' => "请输入银行名称",
+                    'message_id' => $messageId,
+                ];
+                break;
+            default:
+                return [
+
+                ];
+                break;
+        }
+
+
+    }
+
+    static function inputBankName($chatId, $bankName, $messageId)
+    {
+        Cache::put("{$chatId}_QB_WITHDRAW_BANK_NAME", $bankName);
+        return [
+            'chat_id' => $chatId,
+            'text' => "请输入银行卡号",
+            'message_id' => $messageId,
+        ];
+    }
+
 
 }