改进 主机扣费判定

This commit is contained in:
iVampireSP.com 2023-03-02 19:33:48 +08:00
parent 5adb06cd0a
commit 327006e337
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132

View File

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