Ken 2 dni temu
rodzic
commit
828bc20df1
1 zmienionych plików z 48 dodań i 37 usunięć
  1. 48 37
      app/Services/QianBaoWithdrawService.php

+ 48 - 37
app/Services/QianBaoWithdrawService.php

@@ -265,7 +265,7 @@ class QianBaoWithdrawService
         $text .= "💰 当前余额{$temp} RMB\n";
 
 
-        Cache::put(get_step_key($chatId), StepStatus::INPUT_WITHDRAW_QB_MONEY);
+//        Cache::put(get_step_key($chatId), StepStatus::INPUT_WITHDRAW_QB_MONEY);
         return [
             'chat_id' => $chatId,
             'text' => $text,
@@ -273,7 +273,31 @@ class QianBaoWithdrawService
         ];
     }
 
-    //2.输入钱宝提现金额
+    //2.选择银行卡号
+    private static function chooseBank($chatId, $id)
+    {
+//        $amount = Cache::get("{$chatId}_WITHDRAW_QB_MONEY", '');
+//        if (!$amount) return WalletService::getBalance($chatId);
+
+        Cache::put(get_step_key($chatId), StepStatus::INPUT_WITHDRAW_QB_MONEY);
+        Cache::put("{$chatId}_QB_BANK_ID", $id);
+        return [
+            'chat_id' => $chatId,
+            'text' => "请输入提现的金额",
+        ];
+
+//        $bank = Bank::where('id', $id)->first();
+
+
+//        $result = PaymentOrderService::createPayout($chatId, $amount, $bank->channel, $bank->bank_name, $bank->account, $bank->card_no);
+//        return $result;
+        // $text = "提交成功\n";
+        // $text .= "结果将在稍后通知您,请留意通知!!!";
+
+    }
+
+
+    //3.输入钱宝提现金额
     private static function inputQbAmount($chatId, $amount, $messageId)
     {
         if (!preg_match('/^\d+(\.\d{1,2})?$/', $amount)) {
@@ -311,21 +335,30 @@ class QianBaoWithdrawService
             ];
         }
 
-        Cache::put("{$chatId}_WITHDRAW_MONEY", $amount);
-        $list = Bank::where('member_id', $chatId)->get();
-        $keyboard = [];
-        foreach ($list as $item) {
-            $keyboard[] = [['text' => $item->alias, 'callback_data' => "withdrawAddress@@choose_qb_{$item->id}"]];
+
+        $bankId = Cache::get("{$chatId}_QB_BANK_ID");
+        $bank = Bank::where('id', $bankId)->first();
+
+        switch ($bank->channel) {
+            case "DF001":
+                $text = "银行卡提现确认\n";
+                break;
+            case "DF002":
+                $text = "支付宝提现确认\n";
+                $text .= "姓名:{$bank->account}\n";
+                $text .= "提现账号:{$bank->card_no}\n";
+                $text .= "提现金额:{$amount}\n";
+                break;
+
         }
-        $keyboard[] = [
-            ['text' => '🏠 银行卡管理', 'callback_data' => "withdraw@@banks"],
-            ['text' => '❌取消', 'callback_data' => "message@@close"]
+        $keyboard = [
+            [
+                ['text' => "确认", 'callback_data' => '']
+            ],
+            [
+                ['text' => '❌取消', 'callback_data' => "message@@close"]
+            ]
         ];
-
-        $text = "请直接选择下面的地址\n";
-        $text .= "⚠️提示:请务必确认提现地址正确无误,\n否则资金丢失将无法找回请自负!";
-        Cache::put("{$chatId}_WITHDRAW_QB_MONEY", $amount);
-        Cache::put(get_step_key($chatId), StepStatus::CHOOSE_WITHDRAW_QB_ADDRESS);
         return [
             'chat_id' => $chatId,
             'text' => $text,
@@ -334,28 +367,6 @@ class QianBaoWithdrawService
         ];
     }
 
-    //3.选择银行卡号
-    private static function chooseBank($chatId, $id)
-    {
-//        $amount = Cache::get("{$chatId}_WITHDRAW_QB_MONEY", '');
-//        if (!$amount) return WalletService::getBalance($chatId);
-
-
-        Cache::put("{$chatId}_QB_BANK_ID", $id);
-        return [
-            'chat_id' => $chatId,
-            'text' => "请输入提现的金额",
-        ];
-
-//        $bank = Bank::where('id', $id)->first();
-
-
-//        $result = PaymentOrderService::createPayout($chatId, $amount, $bank->channel, $bank->bank_name, $bank->account, $bank->card_no);
-//        return $result;
-        // $text = "提交成功\n";
-        // $text .= "结果将在稍后通知您,请留意通知!!!";
-
-    }
 
     //银行卡管理
     private static function banks($chatId, $messageId)