|
|
@@ -91,6 +91,27 @@ class WithdrawService
|
|
|
}
|
|
|
|
|
|
|
|
|
+ public static function onMessage($chatId, $text, $messageId, $stepStatus)
|
|
|
+ {
|
|
|
+ switch ($stepStatus) {
|
|
|
+ case StepStatus::INPUT_WITHDRAW_MONEY:
|
|
|
+ $res = WithdrawService::inputAmount($chatId, $text, $messageId);
|
|
|
+ $res = $res[0];
|
|
|
+ break;
|
|
|
+ case StepStatus::INPUT_ADDRESS_TRC20:
|
|
|
+ $res = WithdrawService::inputAddress($chatId, $text, $messageId);
|
|
|
+ break;
|
|
|
+ case StepStatus::INPUT_ADDRESS_ALIAS:
|
|
|
+ $res = WithdrawService::inputAlias($chatId, $text, $messageId);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ $res = null;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return $res;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
public static function model(): string
|
|
|
{
|
|
|
return Withdraw::class;
|
|
|
@@ -459,7 +480,7 @@ class WithdrawService
|
|
|
|
|
|
|
|
|
//用户输入提现金额(USDT)
|
|
|
- public function inputAmount($chatId, $amount, $messageId)
|
|
|
+ public static function inputAmount($chatId, $amount, $messageId)
|
|
|
{
|
|
|
if (!preg_match('/^-?\d+(\.\d+)?$/', $amount)) {
|
|
|
return [[
|
|
|
@@ -481,10 +502,12 @@ class WithdrawService
|
|
|
// 汇率
|
|
|
$rate = Config::where('field', 'exchange_rate_rmb')->first()->val ?? 1;
|
|
|
$rate_amount = bcdiv($temp, $rate, 2);
|
|
|
- if ($amount <= $this->serviceCharge) {
|
|
|
+ $serviceCharge = Config::where('field', 'service_charge')->first()->val;
|
|
|
+ $serviceCharge = floatval($serviceCharge);
|
|
|
+ if ($amount <= $serviceCharge) {
|
|
|
return [[
|
|
|
'chat_id' => $chatId,
|
|
|
- 'text' => lang("⚠️提现不能少于") . "{$this->serviceCharge} USDT," . lang('请重试'),
|
|
|
+ 'text' => lang("⚠️提现不能少于") . "{$serviceCharge} USDT," . lang('请重试'),
|
|
|
'reply_to_message_id' => $messageId
|
|
|
]];
|
|
|
}
|
|
|
@@ -637,7 +660,6 @@ class WithdrawService
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
public static function batchReject()
|
|
|
{
|
|
|
$list = Withdraw::where('status', 0)->get();
|