Ken hai 1 semana
pai
achega
2e4030ca61
Modificáronse 1 ficheiros con 1 adicións e 0 borrados
  1. 1 0
      app/Http/Controllers/admin/Wallet.php

+ 1 - 0
app/Http/Controllers/admin/Wallet.php

@@ -84,6 +84,7 @@ class Wallet extends Controller
             $wallet = WalletModel::where('member_id', $memberId)->first();
             if (!$wallet) throw new Exception('用户不存在', HttpStatus::CUSTOM_ERROR);
             $available_balance = bcadd($wallet->available_balance, $amount, 10);
+            if ($available_balance < 0) throw new Exception('可用余额不足', HttpStatus::CUSTOM_ERROR);
             $changeType = ($amount > 0 ? "人工充值" : "人工扣款");
             BalanceLogService::addLog($memberId, $amount, $wallet->available_balance, $available_balance, $changeType, null, $remark);
             $wallet->available_balance = $available_balance;