修改自动推广的相关任务

This commit is contained in:
wangjinlei
2026-05-13 12:26:28 +08:00
parent c36eba77b1
commit fa878334cd
7 changed files with 289 additions and 29 deletions

View File

@@ -51,7 +51,7 @@ 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) {
@@ -59,6 +59,15 @@ class Plagiarism extends Base
}
}
public function testccone(){
$svc = new PlagiarismService();
$checkId = 9;
$filePath = "/home/wwwroot/api.tmrjournals.com/public/manuscirpt/20260509/6832a56e8ace38fe99df390ab5221deb.docx";
$svc->runUploadAndTrigger($checkId,$filePath);
}
/**
* 重试 = 提交一次新查重(保留历史)
*/

View File

@@ -6,6 +6,7 @@ use think\Db;
use think\Env;
use think\Queue;
use think\Validate;
use app\common\CrossrefService;
class Preaccept extends Base
{
@@ -708,36 +709,66 @@ class Preaccept extends Base
}
/**
* 通过 DOI 获取文献元数据Crossref REST API
*
* POST 参数:
* doi 必填,可为纯 DOI10.xxxx/...)或 https://doi.org/10.xxxx/...
*
* 返回 data.formate 与旧版字段兼容: author, title, joura, dateno, doilink
* 另附 data.crossref: 原始摘要字段(不含 raw message避免体积过大
*/
public function searchDoi()
{
$data = $this->request->post();
$rule = new Validate([
"doi" => "require"
'doi' => 'require',
]);
if (!$rule->check($data)) {
return jsonError($rule->getError());
}
$doi = str_replace('/', '%2F', $data['doi']);
// $url = "https://citation.crosscite.org/format?doi=$doi&style=cancer-translational-medicine&lang=en-US";
$url = "https://citation.doi.org/format?doi=$doi&style=cancer-translational-medicine&lang=en-US";
$res = myGet($url);
$frag = trim(substr($res, strpos($res, '.') + 1));
if ($frag == "") {
return jsonError("not find");
$doiInput = trim((string)$data['doi']);
if ($doiInput === '') {
return jsonError('doi empty');
}
if (mb_substr_count($frag, '.') != 3) {
return jsonError("formate fail");
// 去掉 URL 前缀,得到裸 DOI
$doiNorm = preg_replace('#^https?://(dx\.)?doi\.org/#i', '', $doiInput);
$doiNorm = trim($doiNorm, " \t\n\r\0\x0B/");
$svc = new CrossrefService([
'mailto' => trim((string)Env::get('crossref_mailto', '')),
]);
$summary = $svc->fetchWorkSummary($doiNorm);
if ($summary === null || empty($summary['doi'])) {
return jsonError('DOI not found or invalid (Crossref)');
}
$res = explode('.', $frag);
$f['author'] = prgeAuthor($res[0]);
$f['title'] = trim($res[1]);
$bj = bekjournal($res[2]);
$joura = formateJournal(trim($bj[0]));
$f['joura'] = $joura;
$f['dateno'] = str_replace(' ', '', str_replace('-', '', trim($bj[1])));
$f['doilink'] = strpos($data['doi'], "http") === false ? "http://doi.org/" . $data['doi'] : $data['doi'];
$re['formate'] = $f;
return jsonSuccess($re);
$title = trim((string)($summary['title'] ?? ''));
$jouraRaw = trim((string)($summary['joura'] ?? ''));
$authorStr = trim((string)($summary['author_str'] ?? ''));
$dateno = trim((string)($summary['dateno'] ?? ''));
$doilink = trim((string)($summary['doilink'] ?? ''));
if ($doilink === '') {
$doilink = 'https://doi.org/' . $summary['doi'];
}
$f = [
'author' => $authorStr !== '' ? prgeAuthor($authorStr) : '',
'title' => $title,
'joura' => $jouraRaw !== '' ? formateJournal($jouraRaw) : '',
'dateno' => str_replace(' ', '', str_replace('-', '', $dateno)),
'doilink' => $doilink,
];
$crossrefOut = $summary;
unset($crossrefOut['raw']);
return jsonSuccess([
'formate' => $f,
'crossref' => $crossrefOut,
'doi' => $summary['doi'],
]);
}

View File

@@ -10,6 +10,7 @@ use think\Db;
use think\Queue;
use think\Validate;
use think\log;
use app\common\ArticleSymbolNormalizer;
/**
* @title 公共管理相关
@@ -1380,6 +1381,10 @@ class Production extends Base
return $html;
}
public function testsym(){
ArticleSymbolNormalizer::normalize("");
}
public function doTypeSettingNew()
{
@@ -1399,7 +1404,7 @@ class Production extends Base
$editor_info = $this->user_obj->where('user_id', $journal_info['editor_id'])->find();
$typesetInfo = [];
$typesetInfo['info_title'] = $p_info['title'];
$typesetInfo['info_title'] = ArticleSymbolNormalizer::normalize($p_info['title']);
$typesetInfo['info_type'] = $p_info['type'];
$typesetInfo['doi'] = $p_info['doi'];
$typesetInfo['topic'] = '';