修改自动推广的相关任务

This commit is contained in:
wangjinlei
2026-05-08 17:59:08 +08:00
parent 336fa08a18
commit c36eba77b1
4 changed files with 7 additions and 100 deletions

View File

@@ -4,7 +4,6 @@ namespace app\api\job;
use think\queue\Job;
use app\common\PlagiarismService;
use app\common\QueueJob;
/**
* 队列任务:轮询 Turnitin similarity 状态。
@@ -20,37 +19,19 @@ use app\common\QueueJob;
*/
class PlagiarismPoll
{
private $oQueueJob;
public function __construct()
{
$this->oQueueJob = new QueueJob();
}
public function fire(Job $job, $data)
{
$this->oQueueJob->init($job);
$checkId = isset($data['check_id']) ? intval($data['check_id']) : 0;
$attempt = isset($data['attempt']) ? intval($data['attempt']) : 1;
if ($checkId <= 0) {
$this->oQueueJob->log("PlagiarismPoll 无效的 check_id删除任务");
$job->delete();
return;
}
try {
$svc = new PlagiarismService();
$svc->runPollStatus($checkId, $attempt);
$this->oQueueJob->log("PlagiarismPoll 完成一次轮询 | check_id={$checkId} attempt={$attempt}");
$job->delete();
} catch (\Exception $e) {
$this->oQueueJob->handleException($e, $job, "check_id={$checkId} attempt={$attempt}");
} catch (\Throwable $e) {
$this->oQueueJob->handleException($e, $job, "check_id={$checkId} attempt={$attempt}");
} finally {
$this->oQueueJob->finnal();
}
$svc = new PlagiarismService();
$svc->runPollStatus($checkId, $attempt);
$job->delete();
}
}