Ken 2 месяцев назад
Родитель
Сommit
789b314ed3
1 измененных файлов с 12 добавлено и 0 удалено
  1. 12 0
      app/Services/WithdrawService.php

+ 12 - 0
app/Services/WithdrawService.php

@@ -485,9 +485,19 @@ class WithdrawService
                 'reply_to_message_id' => $messageId
             ];
         }
+        $amount = floatval($amount);
         $wallet = Wallet::where('member_id', $chatId)->first();
         $temp = floatval($wallet->available_balance);
 
+        if ($amount > $temp) {
+            return [
+                'chat_id' => $chatId,
+                'text' => "⚠️可用余额不足,请重试",
+                'reply_to_message_id' => $messageId
+            ];
+        }
+
+
         if ($amount < 100) {
             return [
                 'chat_id' => $chatId,
@@ -504,6 +514,8 @@ class WithdrawService
         }
 
 
+        Cache::put("{$chatId}_WITHDRAW_MONEY", $amount);
+
         return [
             'chat_id' => $chatId,
             'text' => "ttttttt",