专刊 作者修回检测是否按照审稿人意见进行修改
This commit is contained in:
@@ -1184,8 +1184,9 @@ class Article extends Base
|
||||
|
||||
/**
|
||||
* @title 判断作者是否已按审稿意见修改(逐条核对最终版)
|
||||
* @description 拆分审稿意见条目,结合修回稿与回复信,用 LLM 逐条判定 addressed/partial/not;可缓存
|
||||
* @description 异步检测:立即返回检测中,后台执行 LLM;请轮询 getRevisionCommentCheckResult
|
||||
* @param name:article_id type:int require:1 desc:文章id
|
||||
* @param name:type type:string require:0 desc:不传=综合(意见+回复信+修回稿);manuscript/response/comment 为单侧触发
|
||||
* @param name:force type:int require:0 desc:1强制重跑,忽略缓存
|
||||
* @param name:mode type:string require:0 desc:full=逐条核对(默认) quick=仅时间门
|
||||
*
|
||||
@@ -1196,7 +1197,7 @@ class Article extends Base
|
||||
{
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'article_id' => 'require|number'
|
||||
'article_id' => 'require|number',
|
||||
]);
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
@@ -1208,13 +1209,18 @@ class Article extends Base
|
||||
|
||||
try {
|
||||
$service = new \app\common\service\RevisionCommentMatchService();
|
||||
$checkType = $service->normalizeCheckType($data['type'] ?? '');
|
||||
if ($mode === 'quick') {
|
||||
return jsonSuccess($service->quickCheck($articleId));
|
||||
$quick = $service->quickCheck($articleId);
|
||||
$quick['check_type'] = $checkType;
|
||||
return jsonSuccess($quick);
|
||||
}
|
||||
|
||||
$result = $service->check($articleId, [
|
||||
'force' => $force,
|
||||
'use_cache' => $force ? 0 : 1,
|
||||
'type' => $checkType,
|
||||
'async' => 1,
|
||||
]);
|
||||
$result['mode'] = 'full';
|
||||
return jsonSuccess($result);
|
||||
@@ -1224,8 +1230,11 @@ class Article extends Base
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取最近一次逐条修回核对结果
|
||||
* @title 获取/触发作者按审稿意见修改的逐条核对结果
|
||||
* @description 有成功结果直接返回;排队/检测中返回 status=1;无任务则投递 RabbitMQ。type 不传=综合检测(意见+回复信+修回稿)
|
||||
* @param name:article_id type:int require:1 desc:文章id
|
||||
* @param name:type type:string require:0 desc:不传=综合;manuscript/response/comment
|
||||
* @param name:force type:int require:0 desc:1强制重新检测,忽略缓存
|
||||
* @url /api/Article/getRevisionCommentCheckResult
|
||||
* @method POST
|
||||
*/
|
||||
@@ -1233,18 +1242,148 @@ class Article extends Base
|
||||
{
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'article_id' => 'require|number'
|
||||
'article_id' => 'require|number',
|
||||
]);
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$articleId = intval($data['article_id']);
|
||||
$force = !empty($data['force']) ? 1 : 0;
|
||||
|
||||
try {
|
||||
$service = new \app\common\service\RevisionCommentMatchService();
|
||||
$checkType = $service->normalizeCheckType($data['type'] ?? '');
|
||||
|
||||
if (!$force) {
|
||||
// 未传 force:始终返回该文章该类型「最新一条」检测记录的进度/结果
|
||||
$latest = $service->getLatestJob($articleId, $checkType, null);
|
||||
if (!empty($latest)) {
|
||||
$latestStatus = intval($latest['status'] ?? 0);
|
||||
if ($latestStatus === \app\common\service\RevisionCommentMatchService::STATUS_SUCCESS) {
|
||||
$detail = $service->getCheckDetail(intval($latest['id']));
|
||||
$detail['mode'] = 'full';
|
||||
return jsonSuccess($detail);
|
||||
}
|
||||
|
||||
$meta = json_decode((string)($latest['result_json'] ?? ''), true);
|
||||
if (!is_array($meta)) {
|
||||
$meta = [];
|
||||
}
|
||||
if ($latestStatus === \app\common\service\RevisionCommentMatchService::STATUS_FAIL) {
|
||||
return jsonSuccess([
|
||||
'article_id' => $articleId,
|
||||
'check_id' => intval($latest['id']),
|
||||
'check_no' => (string)($latest['check_no'] ?? ''),
|
||||
'check_type' => $checkType,
|
||||
'status' => \app\common\service\RevisionCommentMatchService::STATUS_FAIL,
|
||||
'status_text' => '检测失败',
|
||||
'message' => $meta['message'] ?? ($latest['error_msg'] ?? '检测失败'),
|
||||
'error_msg' => $latest['error_msg'] ?? '',
|
||||
'mode' => 'full',
|
||||
]);
|
||||
}
|
||||
|
||||
return jsonSuccess([
|
||||
'article_id' => $articleId,
|
||||
'check_id' => intval($latest['id']),
|
||||
'check_no' => (string)($latest['check_no'] ?? ''),
|
||||
'check_type' => $checkType,
|
||||
'check_type_label' => $meta['check_type_label'] ?? '',
|
||||
'status' => \app\common\service\RevisionCommentMatchService::STATUS_RUNNING,
|
||||
'status_text' => '检测中',
|
||||
'message' => $meta['message'] ?? '检测进行中,请稍后轮询',
|
||||
'mode' => 'full',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
$result = $service->check($articleId, [
|
||||
'force' => $force ? 1 : 0,
|
||||
'use_cache' => $force ? 0 : 1,
|
||||
'type' => $checkType,
|
||||
'async' => 1,
|
||||
]);
|
||||
$result['mode'] = 'full';
|
||||
return jsonSuccess($result);
|
||||
} catch (\Exception $e) {
|
||||
return jsonError($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 审稿意见修改检测可视化报告页
|
||||
* @description 渲染检测报告页面;页面内可触发检测并实时查看逐条结果
|
||||
* @url /api/Article/revisionCommentCheckReport
|
||||
* @method GET
|
||||
*/
|
||||
public function revisionCommentCheckReport()
|
||||
{
|
||||
$apiGetResult = '/index.php/api/Article/getRevisionCommentCheckResult';
|
||||
$apiGetDetail = '/index.php/api/Article/getRevisionCommentCheckDetail';
|
||||
$this->assign([
|
||||
'api_get_result' => $apiGetResult,
|
||||
'api_get_detail' => $apiGetDetail,
|
||||
'init_article_id' => intval($this->request->param('article_id', 0)),
|
||||
'init_check_id' => intval($this->request->param('check_id', 0)),
|
||||
'init_type' => (string)$this->request->param('type', 'all'),
|
||||
]);
|
||||
return $this->fetch('article/revision_comment_check_report');
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 审稿意见修改检测记录列表
|
||||
* @description 仅返回某篇文章最新一条检测记录摘要(含明细条数);详情用 getRevisionCommentCheckDetail
|
||||
* @param name:article_id type:int require:1 desc:文章id
|
||||
* @param name:type type:string require:0 desc:按检测类型过滤,不传=全部
|
||||
* @param name:page type:int require:0 desc:页码,默认1
|
||||
* @param name:page_size type:int require:0 desc:每页条数,默认20
|
||||
* @url /api/Article/listRevisionCommentCheck
|
||||
* @method POST
|
||||
*/
|
||||
public function listRevisionCommentCheck()
|
||||
{
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'article_id' => 'require|number',
|
||||
]);
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
try {
|
||||
$result = (new \app\common\service\RevisionCommentMatchService())
|
||||
->getLatestResult(intval($data['article_id']));
|
||||
if (empty($result)) {
|
||||
return jsonError('暂无检测结果,请先调用 checkAuthorRevisedByReview');
|
||||
}
|
||||
return jsonSuccess($result);
|
||||
$service = new \app\common\service\RevisionCommentMatchService();
|
||||
$list = $service->listChecks(
|
||||
intval($data['article_id']),
|
||||
intval($data['page'] ?? 1),
|
||||
intval($data['page_size'] ?? ($data['pageSize'] ?? 20)),
|
||||
(string)($data['type'] ?? '')
|
||||
);
|
||||
return jsonSuccess($list);
|
||||
} catch (\Exception $e) {
|
||||
return jsonError($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 审稿意见修改检测记录详情(含每条结果)
|
||||
* @description 按 check_id 返回完整检测结果;items 来自明细表,逐条含意见文本、质量评估、是否落实、证据与理由
|
||||
* @param name:check_id type:int require:1 desc:检测记录id
|
||||
* @url /api/Article/getRevisionCommentCheckDetail
|
||||
* @method POST
|
||||
*/
|
||||
public function getRevisionCommentCheckDetail()
|
||||
{
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'check_id' => 'require|number',
|
||||
]);
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
try {
|
||||
$service = new \app\common\service\RevisionCommentMatchService();
|
||||
$detail = $service->getCheckDetail(intval($data['check_id']));
|
||||
$detail['mode'] = 'full';
|
||||
return jsonSuccess($detail);
|
||||
} catch (\Exception $e) {
|
||||
return jsonError($e->getMessage());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user