修复 创建主机时候的问题

This commit is contained in:
iVampireSP.com 2023-02-14 13:40:31 +08:00
parent 38a4d2d3e0
commit 03d4e7a6b8
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132

View File

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