自动查重

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

@@ -2,9 +2,11 @@
namespace app\api\controller;
use app\common\TurnitinService;
use think\Db;
use think\Response;
use app\common\PlagiarismService;
use think\Validate;
/**
* 论文查重Turnitin / Crossref Similarity Check控制器。
@@ -51,7 +53,6 @@ class Plagiarism extends Base
$localPath = $fileUrl !== ''
? $svc->resolveFileUrlToLocal($fileUrl)
: $svc->locateArticleManuscript($articleId);
echo $localPath;
$checkId = $svc->submit($articleId, $localPath, $editorId, 'manual');
return jsonSuccess(['check_id' => $checkId]);
} catch (\Throwable $e) {
@@ -60,12 +61,28 @@ class Plagiarism extends Base
}
public function testccone(){
/**
* 调试与线上一致走队列链upload → wait ingest → trigger → poll需 worker 消费 plagiarism 队列。
*/
public function testccone()
{
$svc = new PlagiarismService();
$checkId = 9;
$filePath = "/home/wwwroot/api.tmrjournals.com/public/manuscirpt/20260509/6832a56e8ace38fe99df390ab5221deb.docx";
$svc->runUploadAndTrigger($checkId,$filePath);
$filePath = '/home/wwwroot/api.tmrjournals.com/public/manuscirpt/20260509/6832a56e8ace38fe99df390ab5221deb.docx';
$svc->runUploadOnly($checkId, $filePath);
}
public function testcconegetstatus(){
$data = $this->request->post();
$rule = new Validate([
"id"=>"require"
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$tii = new TurnitinService();
$res = $tii->getSubmission($data['id']);
return jsonSuccess($res);
}
/**