oQueueJob = new QueueJob(); } public function fire(Job $job, $data) { $this->oQueueJob->init($job); $checkId = isset($data['check_id']) ? intval($data['check_id']) : 0; $filePath = isset($data['file_path']) ? (string)$data['file_path'] : ''; if ($checkId <= 0 || $filePath === '') { $this->oQueueJob->log("PlagiarismRun 无效参数 check_id={$checkId} file_path={$filePath},删除任务"); $job->delete(); return; } try { $svc = new PlagiarismService(); $svc->runUploadAndTrigger($checkId, $filePath); $this->oQueueJob->log("PlagiarismRun 完成 | check_id={$checkId}"); $job->delete(); } catch (\Exception $e) { // PlagiarismService 内部已经把状态置为 failed;致命 DB 错误下 handleException 会 exit(1) $this->oQueueJob->handleException($e, $job, "check_id={$checkId}"); } catch (\Throwable $e) { $this->oQueueJob->handleException($e, $job, "check_id={$checkId}"); } finally { $this->oQueueJob->finnal(); } } }