6
0
Fork 0

优化余额支付

release
李静 2022-01-05 15:21:49 +08:00
parent bfb48b5d43
commit b3687e1eb2
1 changed files with 11 additions and 13 deletions

View File

@ -126,22 +126,20 @@ class WalletController extends Controller
->lockForUpdate() ->lockForUpdate()
->first(); ->first();
if ($payLog === null || !in_array($payLog->pay_way, [PayLog::PAY_WAY_WALLET, PayLog::PAY_WAY_BALANCE])) { if ($payLog === null) {
throw new InvalidPaySerialNumberException(); throw new InvalidPaySerialNumberException();
} }
switch ($payLog->pay_way) { if ($payLog->isBalance()) {
case PayLog::PAY_WAY_WALLET: if ($user->balance->is_frozen) {
if ($user->wallet->is_frozen) { throw new BalanceFrozenException();
throw new WalletFrozenException(); }
} } elseif ($payLog->isWallet()) {
break; if ($user->wallet->is_frozen) {
throw new WalletFrozenException();
case PayLog::PAY_WAY_BALANCE: }
if ($user->balance->is_frozen) { } else {
throw new BalanceFrozenException(); throw new InvalidPaySerialNumberException();
}
break;
} }
$payable = $payLog->payable; $payable = $payLog->payable;