如果用户余额不够,则暂停
This commit is contained in:
parent
e2202c3e17
commit
15b614202e
@ -142,6 +142,13 @@ public function cost($price = null, $auto = true)
|
||||
|
||||
broadcast(new UserEvent($this->user_id, 'balances.drops.reduced', $this->user));
|
||||
|
||||
// 检测用户余额是否足够
|
||||
if ($this->user->balance < 0) {
|
||||
$this->update([
|
||||
'status' => 'suspended',
|
||||
]);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user