Ken 2 zile în urmă
părinte
comite
b69beebdb9

+ 1 - 1
app/Models/Bank.php

@@ -18,7 +18,7 @@ class Bank extends Authenticatable
     use HasApiTokens, Notifiable;
     protected $table = 'banks';
     protected $hidden = ['created_at', 'updated_at'];
-    protected $fillable = ['member_id', 'channel', 'bank_name', 'account', 'card_no'];
+    protected $fillable = ['member_id', 'channel', 'bank_name', 'account', 'card_no','alias'];
 
 
 

+ 43 - 1
app/Services/QianBaoWithdrawService.php

@@ -30,6 +30,12 @@ class QianBaoWithdrawService
             $telegram->editMessageText($res);
         }
 
+        $pattern = "/^withdraw@@qb_choose_.*$/";
+        if (preg_match($pattern, $data)) {
+            $type = preg_replace('/^withdraw@@qb_choose_/', '', $data);
+            $res = QianBaoWithdrawService::showBanks($chatId, $messageId, $type);
+        }
+
 
         if ($data === "withdraw@@qb_apply") {
             $res = QianBaoWithdrawService::qbApply($chatId, $messageId);
@@ -136,16 +142,52 @@ class QianBaoWithdrawService
         $keyboard[] = [
             ['text' => "提现账户管理", 'callback_data' => "withdraw@@banks"],
         ];
+        return [
+            'chat_id' => $chatId,
+            'text' => "请选择提现方式",
+            'message_id' => $messageId,
+            'reply_markup' => json_encode(['inline_keyboard' => $keyboard])
+        ];
+    }
+
+    private static function showBanks($chatId, $messageId, $type)
+    {
+        $channel = '';
+        switch ($type) {
+            case "bank":
+                $text = "请选择提现的银行卡";
+                $channel = 'DF001';
+                break;
+            case "aliPay":
+                $text = "请选择提现的支付宝";
+                $channel = "DF002";
+                break;
+            case "digital_RMB":
+                $text = "暂不支持数字人民币";
+                break;
+        }
+        $list = Bank::where('channel', $channel)->get();
 
 
+        $keyboard = [];
+        foreach ($list as $item) {
+            $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' => "topUp@@home"]];
         return [
             'chat_id' => $chatId,
-            'text' => "请选择提现方式",
+            'text' => $text,
             'message_id' => $messageId,
             'reply_markup' => json_encode(['inline_keyboard' => $keyboard])
         ];
+
+
     }
 
+
     //钱宝账单
     private static function bill($chatId, $firstName, $messageId, $page = 1, $limit = 5)
     {

+ 29 - 0
database/migrations/2025_11_18_132847_update_bank.php

@@ -0,0 +1,29 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration {
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('banks', function (Blueprint $table) {
+            $table->string('alias')->default('')->comment('别名');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        //
+    }
+};