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()
->first();
if ($payLog === null || !in_array($payLog->pay_way, [PayLog::PAY_WAY_WALLET, PayLog::PAY_WAY_BALANCE])) {
if ($payLog === null) {
throw new InvalidPaySerialNumberException();
}
switch ($payLog->pay_way) {
case PayLog::PAY_WAY_WALLET:
if ($user->wallet->is_frozen) {
throw new WalletFrozenException();
}
break;
case PayLog::PAY_WAY_BALANCE:
if ($user->balance->is_frozen) {
throw new BalanceFrozenException();
}
break;
if ($payLog->isBalance()) {
if ($user->balance->is_frozen) {
throw new BalanceFrozenException();
}
} elseif ($payLog->isWallet()) {
if ($user->wallet->is_frozen) {
throw new WalletFrozenException();
}
} else {
throw new InvalidPaySerialNumberException();
}
$payable = $payLog->payable;