修复 单独发给模块时的情况

This commit is contained in:
iVampireSP.com 2022-11-23 21:15:10 +08:00
parent b54d923efe
commit 4856073401
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132

View File

@ -38,10 +38,13 @@ public function handle()
WorkOrder::whereIn('status', ['pending', 'error'])->with(['module', 'user', 'host', 'replies'])->chunk(100, function ($workOrders) {
foreach ($workOrders as $workOrder) {
if ($workOrder->host->status === 'pending') {
continue;
if ($workOrder->host) {
if ($workOrder->host->status === 'pending') {
continue;
}
}
if ($workOrder->status === 'error') {
// 如果 created_at 超过 3 天 use Carbon
if (now()->diffInDays($workOrder->created_at) > 3) {