自动查重

This commit is contained in:
wangjinlei
2026-05-13 18:02:09 +08:00
parent fa878334cd
commit f99dbc6397
6 changed files with 411 additions and 91 deletions

View File

@@ -0,0 +1,33 @@
<?php
namespace app\api\job;
use think\queue\Job;
use app\common\PlagiarismService;
/**
* 队列任务:单次查询 Turnitin submission 是否解析完成ingest未完成则延迟再次入队。
*
* data:
* - check_id t_plagiarism_check.check_id
* - attempt 从 1 递增
*/
class PlagiarismWaitIngest
{
public function fire(Job $job, $data)
{
$checkId = isset($data['check_id']) ? (int) $data['check_id'] : 0;
$attempt = isset($data['attempt']) ? (int) $data['attempt'] : 1;
if ($checkId <= 0) {
$job->delete();
return;
}
$svc = new PlagiarismService();
try {
$svc->runIngestPollStep($checkId, $attempt);
} catch (\Throwable $e) {
$svc->markFailed($checkId, '[ingest] ' . $e->getMessage());
}
$job->delete();
}
}