configurationError()) { $this->error($error); return self::FAILURE; } $limit = max(1, min(10000, (int) $this->option('limit'))); $count = 0; do { try { while ($count < $limit && $service->runOne()) { $count++; $this->line(now()->toDateTimeString()." 已处理 {$count} 个企业任务"); } } catch (\Throwable $e) { if (!$this->option('watch')) throw $e; report($e); $this->error('采集暂时中断,将重试检查任务:'.$e->getMessage()); } if (!$this->option('watch')) break; $count = 0; sleep(5); } while (true); $this->info("本次已处理 {$count} 个企业任务"); return self::SUCCESS; } }