From 327006e33716cd99ecd862ae407092e1018f4be3 Mon Sep 17 00:00:00 2001 From: "iVampireSP.com" Date: Thu, 2 Mar 2023 19:33:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=20=E4=B8=BB=E6=9C=BA?= =?UTF-8?q?=E6=89=A3=E8=B4=B9=E5=88=A4=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Jobs/Host/DispatchHostCostQueueJob.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/app/Jobs/Host/DispatchHostCostQueueJob.php b/app/Jobs/Host/DispatchHostCostQueueJob.php index 4c6bd81..e09f5ca 100644 --- a/app/Jobs/Host/DispatchHostCostQueueJob.php +++ b/app/Jobs/Host/DispatchHostCostQueueJob.php @@ -40,14 +40,15 @@ public function handle(): void if (app()->environment() != 'local') { $host = $host->where('minute_at', $this->minute); } - - $host->whereIn('status', ['running', 'stopped'])->with('user')->chunk(500, function ($hosts) { - foreach ($hosts as $host) { - dispatch(new self($this->minute, $host)); - } + $host->whereIn('status', ['running', 'stopped'])->with(['user', 'module'])->chunk(500, function ($hosts) { + $hosts->each(function ($host) { + if ($host->module->isUp()) { + dispatch(new self($this->minute, $host)); + } + }); }); + } else { + $this->host->cost($this->host->getPrice()); } - - $this->host?->cost($this->host->getPrice()); } }