|
|
@@ -41,6 +41,38 @@ class SanJinRechargeService
|
|
|
}
|
|
|
|
|
|
|
|
|
+ // 支付通道
|
|
|
+ $pattern = '/^topup_channel@@(.+)$/';
|
|
|
+ if (preg_match($pattern, $data, $matches)) {
|
|
|
+ $k = $matches[1];
|
|
|
+
|
|
|
+ // 验证 $k 是否有效
|
|
|
+ $channel = SanJinService::$CHANNEL;
|
|
|
+ if (!isset($channel[$k])) {
|
|
|
+ // 处理无效的通道
|
|
|
+ $text = "无效的支付通道!";
|
|
|
+ $res = [
|
|
|
+ 'chat_id' => $chatId,
|
|
|
+ 'text' => $text
|
|
|
+ ];
|
|
|
+ $telegram->sendMessage($res);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ $data = [];
|
|
|
+ $data['payment_type'] = $k;
|
|
|
+ $data['amount'] = 0;
|
|
|
+ Cache::put($chatId.'_sj_payment', $data);
|
|
|
+ Cache::put(get_step_key($chatId), StepStatus::INPUT_RECHARGE_SJ_MONEY);
|
|
|
+
|
|
|
+ $text = "请输入预充值金额!";
|
|
|
+ $res = [
|
|
|
+ 'chat_id' => $chatId,
|
|
|
+ 'text' => $text
|
|
|
+ ];
|
|
|
+ $telegram->editMessageText($res);
|
|
|
+ }
|
|
|
+
|
|
|
// //选择银行卡号
|
|
|
// $pattern = "/^withdrawAddress@@choose_qb_\d+$/";
|
|
|
// if (preg_match($pattern, $data)) {
|
|
|
@@ -96,21 +128,10 @@ class SanJinRechargeService
|
|
|
public static function onMessage($chatId, $text, $messageId, $stepStatus)
|
|
|
{
|
|
|
switch ($stepStatus) {
|
|
|
- case StepStatus::INPUT_WITHDRAW_QB_MONEY://输入提现金额
|
|
|
+ case StepStatus::INPUT_RECHARGE_SJ_MONEY://输入提现金额
|
|
|
$res = SanJinRechargeService::inputQbAmount($chatId, $text, $messageId);
|
|
|
return $res;
|
|
|
break;
|
|
|
- case StepStatus::QB_INPUT_BANK_NAME://输入银行名称
|
|
|
- $res = SanJinRechargeService::inputBankName($chatId, $text, $messageId);
|
|
|
- return $res;
|
|
|
- case StepStatus::QB_INPUT_CARD_NO://输入银行卡号/支付宝账号
|
|
|
- $res = SanJinRechargeService::inputCardNo($chatId, $text, $messageId);
|
|
|
- return $res;
|
|
|
- break;
|
|
|
- case StepStatus::QB_INPUT_ACCOUNT://输入姓名
|
|
|
- $res = SanJinRechargeService::inputAccount($chatId, $text, $messageId);
|
|
|
- return $res;
|
|
|
- break;
|
|
|
}
|
|
|
return null;
|
|
|
}
|