Ken 2 dias atrás
pai
commit
d41b71db89
1 arquivos alterados com 28 adições e 9 exclusões
  1. 28 9
      app/Services/QianBaoWithdrawService.php

+ 28 - 9
app/Services/QianBaoWithdrawService.php

@@ -76,8 +76,11 @@ class QianBaoWithdrawService
 
 
         //银行卡管理
-        if ($data === 'withdraw@@banks') {
-            $res = QianBaoWithdrawService::banks($chatId, $messageId);
+
+        $pattern = "/^withdraw@@management_.*$/";
+        if (preg_match($pattern, $data)) {
+            $type = preg_replace('/^withdraw@@management_/', '', $data);
+            $res = QianBaoWithdrawService::banks($chatId, $messageId, $type);
             $telegram->editMessageText($res);
         }
 
@@ -174,7 +177,9 @@ class QianBaoWithdrawService
                 $channel = "DF002";
                 break;
             case "digital_RMB":
-                $text = "暂不支持数字人民币";
+                $card = "数字人民币";
+                $text = "请选择提现的账户";
+                $channel = "DF005";
                 break;
         }
         $list = Bank::where('channel', $channel)->get();
@@ -183,7 +188,7 @@ class QianBaoWithdrawService
             $keyboard[] = [['text' => $item->alias, 'callback_data' => "withdrawAddress@@choose_qb_{$item->id}"]];
         }
         $keyboard[] = [
-            ['text' => "{$card}管理", 'callback_data' => "withdraw@@banks"],
+            ['text' => "{$card}管理", 'callback_data' => "withdraw@@management_{$channel}"],
             ['text' => "取消", 'callback_data' => "topUp@@home"]];
         return [
             'chat_id' => $chatId,
@@ -376,20 +381,34 @@ class QianBaoWithdrawService
 
 
     //银行卡管理
-    private static function banks($chatId, $messageId)
+    private static function banks($chatId, $messageId, $channel)
     {
-        $text = "💳️ 银行卡管理\n";
-        $text .= "--------------------------\n";
+        switch ($channel) {
+            case "DF001":
+                $text = "银行卡列表\n";
+
+                break;
+            case "DF002":
+                $text = "支付宝账户列表\n";
+
+                break;
+            case "DF005":
+                $text = "数字人民币账户列表\n";
+
+                break;
+        }
+
 
         $list = Bank::where('member_id', $chatId)
+            ->where("channel", $channel)
             ->get();
 
         $keyboard = [];
         foreach ($list as $item) {
-            $keyboard[] = [['text' => "{$item->bank_name}({$item->card_no})", 'callback_data' => "withdrawAddress@@bank_detail{$item->id}"]];
+            $keyboard[] = [['text' => $item->alias, 'callback_data' => "withdrawAddress@@bank_detail{$item->id}"]];
         }
         if (count($list) < 5) {
-            $keyboard[] = [['text' => "➕ 添加银行卡", 'callback_data' => "withdrawAddress@@bank_add"]];
+            $keyboard[] = [['text' => "➕ 添加", 'callback_data' => "withdrawAddress@@bank_add"]];
         }
         $keyboard[] = [['text' => "↩️返回", 'callback_data' => "topUp@@home"]];
         return [