oQueueJob = new QueueJob(); } public function fire(Job $job, $data) { $this->oQueueJob->init($job); $field = isset($data['field']) ? (string)$data['field'] : ''; if ($field === '') { $this->oQueueJob->log("FetchExperts 无效的 field,删除任务"); $job->delete(); return; } try { $service = new ExpertFinderService(); $service->doFetchForField( $field, isset($data['source']) ? $data['source'] : 'pubmed', isset($data['per_page']) ? intval($data['per_page']) : 100, isset($data['min_year']) ? $data['min_year'] : null ); $this->oQueueJob->log("FetchExperts 完成 | field={$field}"); $job->delete(); } catch (\Exception $e) { $this->oQueueJob->handleException($e, $job, "field={$field}"); } catch (\Throwable $e) { $this->oQueueJob->handleException($e, $job, "field={$field}"); } finally { $this->oQueueJob->finnal(); } } }