|
|
@@ -59,10 +59,8 @@ class SanJinRechargeService
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- $data = [];
|
|
|
- $data['payment_type'] = $k;
|
|
|
- $data['amount'] = 0;
|
|
|
- Cache::put($chatId.'_sj_payment', $data);
|
|
|
+
|
|
|
+ Cache::put($chatId.'_sj_payment_type', $k);
|
|
|
Cache::put(get_step_key($chatId), StepStatus::INPUT_RECHARGE_SJ_MONEY);
|
|
|
|
|
|
$text = "请输入预充值金额!";
|
|
|
@@ -130,7 +128,7 @@ class SanJinRechargeService
|
|
|
{
|
|
|
switch ($stepStatus) {
|
|
|
case StepStatus::INPUT_RECHARGE_SJ_MONEY://输入提现金额
|
|
|
- $res = SanJinRechargeService::inputQbAmount($chatId, $text, $messageId);
|
|
|
+ $res = SanJinRechargeService::inputSjAmount($chatId, $text, $messageId);
|
|
|
return $res;
|
|
|
break;
|
|
|
}
|
|
|
@@ -237,65 +235,43 @@ class SanJinRechargeService
|
|
|
}
|
|
|
|
|
|
//2.输入三斤提现金额
|
|
|
- private static function inputQbAmount($chatId, $amount, $messageId)
|
|
|
+ private static function inputSjAmount($chatId, $amount, $messageId)
|
|
|
{
|
|
|
- if (!preg_match('/^\d+(\.\d{1,2})?$/', $amount)) {
|
|
|
- return [
|
|
|
+ // 支付通道
|
|
|
+ $paymentType = Cache::get($chatId.'_sj_payment_type');
|
|
|
+ if(empty($paymentType)){
|
|
|
+ // 处理无效的通道
|
|
|
+ $text = "无效的支付通道!";
|
|
|
+ $res = [
|
|
|
'chat_id' => $chatId,
|
|
|
- 'text' => "金额输入不正确,请发送提现数字",
|
|
|
- 'reply_to_message_id' => $messageId
|
|
|
+ 'text' => $text
|
|
|
];
|
|
|
+ return $res;
|
|
|
}
|
|
|
- $amount = floatval($amount);
|
|
|
- $wallet = Wallet::where('member_id', $chatId)->first();
|
|
|
- $temp = floatval($wallet->available_balance);
|
|
|
|
|
|
- if ($amount > $temp) {
|
|
|
- return [
|
|
|
+ // 验证 $k 是否有效
|
|
|
+ $channel = SanJinService::$CHANNEL;
|
|
|
+ if (!isset($channel[$paymentType])) {
|
|
|
+ // 处理无效的通道
|
|
|
+ $text = "无效的支付通道!";
|
|
|
+ $res = [
|
|
|
'chat_id' => $chatId,
|
|
|
- 'text' => "⚠️可用余额不足,请重试",
|
|
|
- 'reply_to_message_id' => $messageId
|
|
|
+ 'text' => $text
|
|
|
];
|
|
|
+ return $res;
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- if ($amount < 100) {
|
|
|
- return [
|
|
|
- 'chat_id' => $chatId,
|
|
|
- 'text' => "⚠️提现不能少于100 RMB,请重试",
|
|
|
- 'reply_to_message_id' => $messageId
|
|
|
- ];
|
|
|
- }
|
|
|
- if ($amount > 49999) {
|
|
|
+ if (!preg_match('/^\d+(\.\d{1,2})?$/', $amount)) {
|
|
|
return [
|
|
|
'chat_id' => $chatId,
|
|
|
- 'text' => "⚠️最多提现 49999 RMB,请重试",
|
|
|
+ 'text' => "金额输入不正确,请发送预充值数字",
|
|
|
'reply_to_message_id' => $messageId
|
|
|
];
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- Cache::put("{$chatId}_WITHDRAW_MONEY", $amount);
|
|
|
- $list = Bank::where('member_id', $chatId)->get();
|
|
|
- $keyboard = [];
|
|
|
- foreach ($list as $item) {
|
|
|
- $keyboard[] = [['text' => "{$item->bank_name}({$item->card_no})", 'callback_data' => "withdrawAddress@@choose_qb_{$item->id}"]];
|
|
|
- }
|
|
|
- $keyboard[] = [
|
|
|
- ['text' => '🏠 银行卡管理', 'callback_data' => "withdraw@@banks"],
|
|
|
- ['text' => '❌取消', 'callback_data' => "message@@close"]
|
|
|
- ];
|
|
|
-
|
|
|
- $text = "请直接选择下面的地址\n";
|
|
|
- $text .= "⚠️提示:请务必确认提现地址正确无误,\n否则资金丢失将无法找回请自负!";
|
|
|
- Cache::put("{$chatId}_WITHDRAW_QB_MONEY", $amount);
|
|
|
- Cache::put(get_step_key($chatId), StepStatus::CHOOSE_WITHDRAW_QB_ADDRESS);
|
|
|
- return [
|
|
|
- 'chat_id' => $chatId,
|
|
|
- 'text' => $text,
|
|
|
- 'reply_to_message_id' => $messageId,
|
|
|
- 'reply_markup' => json_encode(['inline_keyboard' => $keyboard])
|
|
|
- ];
|
|
|
+
|
|
|
+ $res = PaymentOrderService::createPay($chatId,$amount,$paymentType);
|
|
|
+ return $res;
|
|
|
}
|
|
|
|
|
|
//3.选择银行卡号
|