自动查重

This commit is contained in:
wangjinlei
2026-05-20 14:46:58 +08:00
parent cfa3f791f4
commit 4940db73fe
5 changed files with 290 additions and 88 deletions

View File

@@ -197,16 +197,30 @@ class Plagiarism extends Base
if ($needRefresh) {
$svc = new PlagiarismService();
$info = $svc->refreshViewerUrlFor($checkId);
if ($info['url'] === '') {
return jsonError('Turnitin returned empty viewer_url');
}
return jsonSuccess([
'view_only_url' => $info['url'],
'expire' => $info['expire'],
'has_pdf' => !empty($info['local_pdf']),
]);
}
return jsonSuccess([
'view_only_url' => $row['view_only_url'],
'expire' => intval($row['view_only_url_expire']),
'has_pdf' => !empty($row['pdf_local_path']),
]);
} catch (\Throwable $e) {
if (!empty($row['pdf_local_path'])) {
return jsonSuccess([
'view_only_url' => '',
'expire' => 0,
'has_pdf' => true,
'viewer_error' => $e->getMessage(),
'hint' => '在线报告暂不可用,请使用 downloadReport 下载 PDF',
]);
}
return jsonError($e->getMessage());
}
}