允许余额为负数
This commit is contained in:
parent
4d1cdf643d
commit
01bb962623
@ -59,17 +59,16 @@ public function toDrops($amount = 1)
|
||||
try {
|
||||
$lock->block(5);
|
||||
|
||||
// if user balance <= 0
|
||||
if ($this->balance < $amount) {
|
||||
throw new BalanceNotEnoughException('余额不足');
|
||||
}
|
||||
|
||||
$this->balance -= $amount;
|
||||
$this->save();
|
||||
|
||||
// increment user drops
|
||||
Cache::increment($cache_key, $total);
|
||||
|
||||
// if user balance <= 0
|
||||
if ($this->balance < $amount) {
|
||||
throw new BalanceNotEnoughException('余额不足');
|
||||
}
|
||||
} catch (LockTimeoutException) {
|
||||
throw new CommonException('暂时无法处理此请求,请稍后再试。');
|
||||
} finally {
|
||||
|
Loading…
Reference in New Issue
Block a user