Ken 2 ay önce
ebeveyn
işleme
d99601face

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

@@ -204,6 +204,13 @@ class TelegramWebHook extends Controller
                     $telegram->editMessageText($res);
                 }
 
+
+                //银行卡管理
+                if ($data === 'withdraw@@banks') {
+                    $res = WithdrawService::banks($chatId, $messageId);
+                    $telegram->editMessageText($res);
+                }
+
                 //地址管理
                 if ($data === 'withdraw@@address') {
                     $res = WithdrawService::getAddress($chatId, $messageId);

+ 27 - 1
app/Services/WithdrawService.php

@@ -475,6 +475,32 @@ class WithdrawService
         ]];
     }
 
+    //银行卡管理
+    static function banks($chatId, $messageId)
+    {
+        $text = "🏠 银行卡管理\n";
+        $text .= "--------------------------\n";
+
+        $list = Bank::where('member_id', $chatId)
+            ->get();
+
+        $keyboard = [];
+        foreach ($list as $item) {
+            $keyboard[] = [['text' => "$item->card_no($item->bank_name)", 'callback_data' => "withdrawAddress@@bank_detail{$item->id}"]];
+        }
+        if (count($list) < 5) {
+            $keyboard[] = [['text' => "➕ 添加银行卡", 'callback_data' => "withdrawAddress@@bang_add"]];
+        }
+        $keyboard[] = [['text' => "↩️返回", 'callback_data' => "withdraw@@home"]];
+        return [
+            'chat_id' => $chatId,
+            'text' => $text,
+            'message_id' => $messageId,
+            'reply_markup' => json_encode(['inline_keyboard' => $keyboard])
+        ];
+    }
+
+
     //选择银行卡号
     static function chooseBank($chatId, $firstName, $messageId, $id)
     {
@@ -540,7 +566,7 @@ class WithdrawService
             $keyboard[] = [['text' =>"$item->card_no($item->bank_name)", 'callback_data' => "withdrawAddress@@choose_qb_{$item->id}"]];
         }
         $keyboard[] = [
-            ['text' => '🏠 银行卡管理', 'callback_data' => "withdraw@@address"],
+            ['text' => '🏠 银行卡管理', 'callback_data' => "withdraw@@banks"],
             ['text' => '❌取消', 'callback_data' => "message@@close"]
         ];