Ken há 1 mês atrás
pai
commit
4f720a3188
1 ficheiros alterados com 16 adições e 0 exclusões
  1. 16 0
      app/Services/QianBaoWithdrawService.php

+ 16 - 0
app/Services/QianBaoWithdrawService.php

@@ -58,12 +58,20 @@ class QianBaoWithdrawService
             $telegram->editMessageText($res);
         }
 
+        $pattern = "/^withdraw@@bank_del_\d+$/";
+        if (preg_match($pattern, $data)) {
+            $id = preg_replace('/^withdraw@@bank_del_/', '', $data);
+            $res = static::bankDelete($chatId, $messageId, $id);
+            $telegram->editMessageText($res);
+        }
+
 
         //添加银行卡
         if ($data === "withdrawAddress@@bank_add") {
             $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);
@@ -203,6 +211,14 @@ class QianBaoWithdrawService
         ];
     }
 
+    static function bankDelete($chatId, $messageId, $id)
+    {
+        Bank::where('id', $id)
+            ->where('member_id', $chatId)->delete();
+
+        return static::banks($chatId, $messageId);
+    }
+
     static function bankDetails($chatId, $messageId, $id)
     {