|
|
@@ -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;
|