From 03d4e7a6b8909ee9a096c9cbfab2576086d78b7a Mon Sep 17 00:00:00 2001 From: "iVampireSP.com" Date: Tue, 14 Feb 2023 13:40:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E4=B8=BB=E6=9C=BA=E6=97=B6=E5=80=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Module/HostController.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/Http/Controllers/Module/HostController.php b/app/Http/Controllers/Module/HostController.php index 4a90c59..0ff3cf4 100644 --- a/app/Http/Controllers/Module/HostController.php +++ b/app/Http/Controllers/Module/HostController.php @@ -67,6 +67,11 @@ public function store(Request $request): Response|JsonResponse $host = (new Host)->create($data); + if (!$user->hasBalance($host->getRenewPrice())) { + $host->delete(); + return $this->error('此用户余额不足,无法开计费项目。'); + } + $host['host_id'] = $host->id; return $this->created($host);