seven 3 giorni fa
parent
commit
873c3b08fa
1 ha cambiato i file con 22 aggiunte e 11 eliminazioni
  1. 22 11
      app/Services/SanJinRechargeService.php

+ 22 - 11
app/Services/SanJinRechargeService.php

@@ -9,6 +9,7 @@ use App\Models\PaymentOrder;
 use App\Models\Wallet;
 use Illuminate\Support\Facades\Cache;
 use Telegram\Bot\Api;
+use App\Services\Payment\SanJinService;
 
 class SanJinRechargeService
 {
@@ -22,11 +23,11 @@ class SanJinRechargeService
      */
     public static function init(Api $telegram, $data, $chatId, $firstName, $messageId)
     {
-        // //点击三斤提现按钮
-        // if ($data === "withdraw@@qb_apply") {
-        //     $res = SanJinRechargeService::qbApply($chatId, $messageId);
-        //     $telegram->editMessageText($res);
-        // }
+        //点击三斤充值按钮
+        if ($data === "topup@@sj_apply") {
+            $res = SanJinRechargeService::qbApply($chatId, $messageId);
+            $telegram->editMessageText($res);
+        }
 
 
         //三斤账单
@@ -175,7 +176,7 @@ class SanJinRechargeService
         ];
     }
 
-    //1.三斤提现
+    //1.三斤充值
     private static function qbApply($chatId, $messageId)
     {
         $three_payment_switch = Config::where('field', 'three_payment_switch')->first()->val;
@@ -185,17 +186,27 @@ class SanJinRechargeService
             return $res;
         }
 
-        $wallet = Wallet::where('member_id', $chatId)->first();
-        $temp = floatval($wallet->available_balance);
-        $text = "请发送提现金额\n";
-        $text .= "💰 当前余额{$temp} RMB\n";
+        $text = "请选择支付的通道 \n";
+        $keyboard = [];
+        $channel = SanJinService::$CHANNEL;
+
+        foreach($channel as $k => $v){
+            $keyboard[] = [
+                ['text' => $v, 'callback_data' => "topup_channel@@" .$k]
+            ];
+        }
+        // $wallet = Wallet::where('member_id', $chatId)->first();
+        // $temp = floatval($wallet->available_balance);
+        // $text = "请发送提现金额\n";
+        // $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,
             'message_id' => $messageId,
+            'reply_markup' => json_encode(['inline_keyboard' => $keyboard])
         ];
     }