Ken 2 tygodni temu
rodzic
commit
60ee14d852

+ 10 - 256
app/Services/SanJinRechargeService.php

@@ -62,7 +62,7 @@ class SanJinRechargeService extends BaseService
             $channel = SanJinService::$CHANNEL;
             if (!isset($channel[$k])) {
                 // 处理无效的通道
-                $text = "无效的支付通道!";
+                $text = lang("无效的支付通道!");
                 $res = [
                     'chat_id' => $chatId,
                     'text' => $text
@@ -87,7 +87,7 @@ class SanJinRechargeService extends BaseService
                 if ($v['type'] == $paymentType) {
 
                     if($v['type'] == 'zfbge'){
-                        $rechargeText = "充值金额:(".implode(',',$v['fixed']).") \n";
+                        $rechargeText = lang('充值金额').":(".implode(',',$v['fixed']).") \n";
 
                         foreach($v['fixed'] as $num){
                             $keyboard[] = [
@@ -114,14 +114,14 @@ class SanJinRechargeService extends BaseService
             }
 
             
-            $text = "请输入充值的金额 \n";
+            $text = lang("请输入充值的金额")." \n";
             // $text .= "充值方式:".$channel[$k];
             if($rechargeText){
                 $text .= $rechargeText;
-                $text .= "🔔 提示:请选择下方充值的金额";
+                $text .= lang("🔔 提示:请选择下方充值的金额");
             }else{
-                $text .= "充值金额:{$min} - {$max} \n";
-                $text .= "🔔 提示:请务必核对(充值最大金额和最小金额,账号信息一致),若不一致无法到账。";
+                $text .= lang("充值金额").":{$min} - {$max} \n";
+                $text .= lang("🔔 提示:请务必核对(充值最大金额和最小金额,账号信息一致),若不一致无法到账。");
     
             }
 
@@ -135,57 +135,6 @@ class SanJinRechargeService extends BaseService
             }
             $telegram->editMessageText($res);
         }
-
-        // //选择银行卡号
-        // $pattern = "/^withdrawAddress@@choose_qb_\d+$/";
-        // if (preg_match($pattern, $data)) {
-        //     $id = preg_replace('/^withdrawAddress@@choose_qb_/', '', $data);
-        //     $res = SanJinRechargeService::chooseBank($chatId, $id);
-        //     $telegram->deleteMessage([
-        //         'chat_id' => $chatId,
-        //         'message_id' => $messageId,
-        //     ]);
-        //     $telegram->sendMessage($res);
-        // }
-
-
-        // //银行卡管理
-        // if ($data === 'withdraw@@banks') {
-        //     $res = SanJinRechargeService::banks($chatId, $messageId);
-        //     $telegram->editMessageText($res);
-        // }
-
-
-        // //银行卡详情
-        // $pattern = "/^withdrawAddress@@bank_detail\d+$/";
-        // if (preg_match($pattern, $data)) {
-        //     $id = preg_replace('/^withdrawAddress@@bank_detail/', '', $data);
-        //     $res = static::bankDetails($chatId, $messageId, $id);
-        //     $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 = SanJinRechargeService::addBank($chatId, $messageId);
-        //     $telegram->editMessageText($res);
-        // }
-
-        // $pattern = "/^withdrawAddress@@bank_choose_channel_.*$/";
-        // if (preg_match($pattern, $data)) {
-        //     $channel = preg_replace('/^withdrawAddress@@bank_choose_channel_/', '', $data);
-        //     $res = static::chooseChannel($chatId, $messageId, $channel);
-        //     $telegram->editMessageText($res);
-        // }
-
-
     }
 
     public static function onMessage($chatId, $text, $messageId, $stepStatus)
@@ -287,7 +236,7 @@ class SanJinRechargeService extends BaseService
         
 
         $keyboard[] = [
-            ['text' => "返回", 'callback_data' => "topUp@@home"]
+            ['text' => lang("↩️返回"), 'callback_data' => "topUp@@home"]
         ];
         // $wallet = Wallet::where('member_id', $chatId)->first();
         // $temp = floatval($wallet->available_balance);
@@ -311,7 +260,7 @@ class SanJinRechargeService extends BaseService
         $paymentType = Cache::get($chatId.'_sj_payment_type');
         if(empty($paymentType)){
             // 处理无效的通道
-            $text = "无效的支付通道!";
+            $text = lang("无效的支付通道!");
             $res = [
                 'chat_id' => $chatId,
                 'text' => $text
@@ -323,7 +272,7 @@ class SanJinRechargeService extends BaseService
         $channel = SanJinService::$CHANNEL;
         if (!isset($channel[$paymentType])) {
             // 处理无效的通道
-            $text = "无效的支付通道!";
+            $text = lang("无效的支付通道!");
             $res = [
                 'chat_id' => $chatId,
                 'text' => $text
@@ -335,7 +284,7 @@ class SanJinRechargeService extends BaseService
         if (!preg_match('/^\d+(\.\d{1,2})?$/', $amount)) {
             return [
                 'chat_id' => $chatId,
-                'text' => "金额输入不正确,请发送预充值数字",
+                'text' => lang("金额输入不正确,请发送预充值数字"),
                 'reply_to_message_id' => $messageId
             ];
         }
@@ -347,202 +296,7 @@ class SanJinRechargeService extends BaseService
         return $res;
     }
 
-    //3.选择银行卡号
-    private static function chooseBank($chatId, $id)
-    {
-        $amount = Cache::get("{$chatId}_WITHDRAW_QB_MONEY", '');
-        if (!$amount) return WalletService::getBalance($chatId);
-
-        $bank = Bank::where('id', $id)->first();
-        $result = PaymentOrderService::createPayout($chatId, $amount, $bank->getChannel(), $bank->getBankName(), $bank->getAccount(), $bank->getCardNo());
-        return $result;
-        // $text = "提交成功\n";
-        // $text .= "结果将在稍后通知您,请留意通知!!!";
-        // return [
-        //     'chat_id' => $chatId,
-        //     'text' => $text,
-        // ];
-    }
-
-    //银行卡管理
-    private static function banks($chatId, $messageId)
-    {
-        $text = "💳️ 银行卡管理\n";
-        $text .= "--------------------------\n";
-
-        $list = Bank::where('member_id', $chatId)
-            ->get();
 
-        $keyboard = [];
-        foreach ($list as $item) {
-            $keyboard[] = [['text' => "{$item->bank_name}({$item->card_no})", '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,
-            'message_id' => $messageId,
-            'reply_markup' => json_encode(['inline_keyboard' => $keyboard])
-        ];
-    }
-
-    //银行卡详情
-    private static function bankDetails($chatId, $messageId, $id)
-    {
 
-        $text = "*银行卡管理*\n\n";
-        $bank = Bank::where('id', $id)
-            ->where('member_id', $chatId)->first();
 
-        switch ($bank->getChannel()) {
-            case "DF001":
-                $text .= "姓名:{$bank->getAccount()}\n";
-                $text .= "银行:{$bank->getBankName()}\n";
-                $text .= "卡号:{$bank->getCardNo()}\n";
-                break;
-            case "DF002":
-                $text .= "姓名:{$bank->getAccount()}\n";
-                $text .= "银行:{$bank->getBankName()}\n";
-                $text .= "账号:{$bank->getCardNo()}\n";
-                break;
-            default:
-                $text .= "姓名:{$bank->getAccount()}\n";
-                $text .= "银行:{$bank->getBankName()}\n";
-                $text .= "卡号:{$bank->getCardNo()}\n";
-                break;
-        }
-
-
-        $keyboard = [
-            [['text' => '❌删除该地址', 'callback_data' => "withdraw@@bank_del_{$id}"]],
-            [['text' => '↩️返回列表', 'callback_data' => 'withdraw@@banks']]
-        ];
-        return [
-            'chat_id' => $chatId,
-            'parse_mode' => 'MarkdownV2',
-            'text' => $text,
-            'reply_markup' => json_encode(['inline_keyboard' => $keyboard]),
-            'message_id' => $messageId
-        ];
-    }
-
-    //删除银行卡
-    private static function bankDelete($chatId, $messageId, $id)
-    {
-        Bank::where('id', $id)
-            ->where('member_id', $chatId)->delete();
-
-        return static::banks($chatId, $messageId);
-    }
-
-    //添加银行卡
-    private static function addBank($chatId, $messageId)
-    {
-        $text = "请选择 提现通道\n";
-
-        $keyboard = [
-            [
-                ['text' => '银行卡', 'callback_data' => "withdrawAddress@@bank_choose_channel_DF001"],
-                ['text' => '支付宝', 'callback_data' => "withdrawAddress@@bank_choose_channel_DF002"]
-            ],
-            [
-                ['text' => '❌取消', 'callback_data' => "message@@close"]
-            ]
-        ];
-        return [
-            'chat_id' => $chatId,
-            'text' => $text,
-            'message_id' => $messageId,
-            'reply_markup' => json_encode(['inline_keyboard' => $keyboard])
-        ];
-    }
-
-    //选择通道
-    private static function chooseChannel($chatId, $messageId, $channel)
-    {
-        Cache::put("{$chatId}_QB_WITHDRAW_CHANNEL", $channel);
-
-        switch ($channel) {
-            case "DF002"://支付宝
-                Cache::put("{$chatId}_QB_WITHDRAW_BANK_NAME", '支付宝');
-                Cache::put(get_step_key($chatId), StepStatus::QB_INPUT_CARD_NO);
-                return [
-                    'chat_id' => $chatId,
-                    'text' => "请输入支付宝账号",
-                    'message_id' => $messageId,
-                ];
-                break;
-            case "DF001"://银行卡
-                Cache::put(get_step_key($chatId), StepStatus::QB_INPUT_BANK_NAME);
-                return [
-                    'chat_id' => $chatId,
-                    'text' => "请输入银行名称",
-                    'message_id' => $messageId,
-                ];
-                break;
-            default:
-                return [
-                    'chat_id' => $chatId,
-                    'text' => "选择通道错误",
-                    'message_id' => $messageId,
-                ];
-                break;
-        }
-
-
-    }
-
-    //输入银行名称
-    private static function inputBankName($chatId, $bankName, $messageId)
-    {
-        Cache::put("{$chatId}_QB_WITHDRAW_BANK_NAME", $bankName);
-        Cache::put(get_step_key($chatId), StepStatus::QB_INPUT_CARD_NO);
-        return [
-            'chat_id' => $chatId,
-            'text' => "请输入银行卡号",
-            'message_id' => $messageId,
-        ];
-    }
-
-    //输入卡号
-    private static function inputCardNo($chatId, $cardNo, $messageId)
-    {
-        $channel = Cache::get("{$chatId}_QB_WITHDRAW_CHANNEL");
-        if ($channel === 'DF001' && !preg_match('/^\d+$/', $cardNo)) {
-            return [
-                'chat_id' => $chatId,
-                'text' => "输入的银行卡号有误,请重新输入",
-                'reply_to_message_id' => $messageId,
-            ];
-        }
-
-
-        Cache::put("{$chatId}_QB_WITHDRAW_CARD_NO", $cardNo);
-        Cache::put(get_step_key($chatId), StepStatus::QB_INPUT_ACCOUNT);
-
-        return [
-            'chat_id' => $chatId,
-            'text' => "请输入姓名",
-            'message_id' => $messageId,
-        ];
-    }
-
-    //输入姓名,并保存到数据库
-    private static function inputAccount($chatId, $account, $messageId)
-    {
-        $channel = Cache::get("{$chatId}_QB_WITHDRAW_CHANNEL");
-        $cardNo = Cache::get("{$chatId}_QB_WITHDRAW_CARD_NO");
-        $bankName = Cache::get("{$chatId}_QB_WITHDRAW_BANK_NAME");
-        Bank::create([
-            'member_id' => $chatId,
-            'account' => $account,
-            'channel' => $channel,
-            'card_no' => $cardNo,
-            'bank_name' => $bankName
-        ]);
-        return static::banks($chatId, $messageId);
-    }
 }

+ 7 - 0
lang/en/messages.php

@@ -139,6 +139,13 @@ return [
     "支付宝转卡" => "Alipay Transfer to Card",
     "银联扫码" => "UnionPay QR Code",
     "手动金条" => "Manual Gold Bar",
+    "无效的支付通道!" => "Invalid payment channel!",
+    "金额输入不正确,请发送预充值数字" => "The amount entered is incorrect, please send the pre-recharge number",
+    "💳️ 银行卡管理" => "💳️ Bank Card Management",
+    "充值金额" => "Recharge Amount",
+    "请输入充值的金额" => "Please enter the recharge amount",
+    "🔔 提示:请选择下方充值的金额" => "🔔 Tip: Please select the recharge amount below",
+    "🔔 提示:请务必核对(充值最大金额和最小金额,账号信息一致),若不一致无法到账。" => "🔔 Tip: Please ensure that (the maximum and minimum recharge amounts, and account information are consistent), if not, the funds will not be credited.",
 
 
 

+ 7 - 0
lang/vi/messages.php

@@ -139,6 +139,13 @@ return [
     "支付宝转卡" => "Chuyển thẻ Alipay",
     "银联扫码" => "Quét mã UnionPay",
     "手动金条" => "Vàng thỏi thủ công",
+    "无效的支付通道!" => "Kênh thanh toán không hợp lệ!",
+    "金额输入不正确,请发送预充值数字" => "Số tiền nhập không đúng, vui lòng gửi số tiền nạp trước",
+    "💳️ 银行卡管理" => "💳️ Quản lý thẻ ngân hàng",
+    "充值金额" => "Số tiền nạp",
+    "请输入充值的金额" => "Vui lòng nhập số tiền nạp",
+    "🔔 提示:请选择下方充值的金额" => "🔔 Lưu ý: Vui lòng chọn số tiền nạp dưới đây",
+    "🔔 提示:请务必核对(充值最大金额和最小金额,账号信息一致),若不一致无法到账。" => "🔔 Lưu ý: Vui lòng kiểm tra kỹ (số tiền nạp tối đa và tối thiểu, thông tin tài khoản chính xác), nếu không khớp sẽ không thể chuyển tiền vào tài khoản.",
 
 
 

+ 7 - 0
lang/zh/messages.php

@@ -139,5 +139,12 @@ return [
     "支付宝转卡" => "支付宝转卡",
     "银联扫码" => "银联扫码",
     "手动金条" => "手动金条",
+    "无效的支付通道!" => "无效的支付通道!",
+    "金额输入不正确,请发送预充值数字" => "金额输入不正确,请发送预充值数字",
+    "💳️ 银行卡管理" => "💳️ 银行卡管理",
+    "充值金额" => "充值金额",
+    "请输入充值的金额"=>"请输入充值的金额",
+    "🔔 提示:请选择下方充值的金额"=>"🔔 提示:请选择下方充值的金额",
+    "🔔 提示:请务必核对(充值最大金额和最小金额,账号信息一致),若不一致无法到账。"=>"🔔 提示:请务必核对(充值最大金额和最小金额,账号信息一致),若不一致无法到账。",
 
 ];