From 15b614202e2a6c97c64ddf1a48ac59c2cb853335 Mon Sep 17 00:00:00 2001 From: "iVampireSP.com" Date: Wed, 28 Sep 2022 13:24:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A6=82=E6=9E=9C=E7=94=A8=E6=88=B7=E4=BD=99?= =?UTF-8?q?=E9=A2=9D=E4=B8=8D=E5=A4=9F=EF=BC=8C=E5=88=99=E6=9A=82=E5=81=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/Host.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/Models/Host.php b/app/Models/Host.php index d7f7acc..01e2d72 100644 --- a/app/Models/Host.php +++ b/app/Models/Host.php @@ -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; }