如果用户余额不够,则暂停

This commit is contained in:
iVampireSP.com 2022-09-28 13:24:23 +08:00
parent e2202c3e17
commit 15b614202e
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132

View File

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