文献校对功能完善

This commit is contained in:
wyn
2026-05-27 16:09:23 +08:00
parent 1fcd6a129d
commit 94b212fe7c
4 changed files with 681 additions and 80 deletions

View File

@@ -898,7 +898,17 @@ class Preaccept extends Base
return jsonSuccess($re);
}
public function getArticleMainById(){
$data = $this->request->post();
$rule = new Validate([
"am_id"=>"require"
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$am_info = $this->article_main_obj->where("am_id",$data['am_id'])->find();
return jsonSuccess($am_info);
}
public function changeH1(){
$data = $this->request->post();

View File

@@ -11,6 +11,7 @@ use think\Validate;
use think\Db;
use think\Env;
use think\Queue;
use app\common\ReferenceCheckService;
/**
* @title 参考文献
* @description 相关方法汇总
@@ -1499,12 +1500,72 @@ class References extends Base
}
/**
* 按 p_refer_id 查单条参考文献的校对明细
* 多篇文章并行校对时,查询指定文章前面还有几篇在排队
*
* POST/GET: p_article_id必填
*
* 例:当前 5 篇文章正在校对,该文排在第 3 → ahead=2, position=3, running_total=5。
* 返回running_total、ahead、position、in_queue、status整篇校对状态 0/1/2
*/
public function referenceCheckPendingCountAI()
{
$aParam = $this->request->post();
if (empty($aParam)) {
$aParam = $this->request->param();
}
$iPArticleId = empty($aParam['p_article_id']) ? 0 : intval($aParam['p_article_id']);
if ($iPArticleId <= 0) {
return json_encode(array('status' => 2, 'msg' => 'Please select an article'));
}
try {
$result = (new ReferenceCheckService())->getArticleCheckQueuePositionByPArticleId($iPArticleId);
return jsonSuccess($result);
} catch (\Exception $e) {
return jsonError($e->getMessage());
}
}
/**
* 某条参考文献下「校对失败」的明细重新校对(异步)
*
* POST/GET: p_refer_id必填
* p_article_id可选
*
* 仅重跑 status=3校对失败的记录不改动 refer_text只重置结果字段后入 ReferenceCheck 队列。
* 返回p_refer_id、p_article_id、reset、queued、check_ids、queue
*/
public function referenceCheckRecheckFailedAI()
{
$aParam = $this->request->post();
if (empty($aParam)) {
$aParam = $this->request->param();
}
$iPReferId = empty($aParam['p_refer_id']) ? 0 : intval($aParam['p_refer_id']);
if ($iPReferId <= 0) {
return json_encode(array('status' => 2, 'msg' => 'Please select a reference'));
}
$iPArticleId = empty($aParam['p_article_id']) ? 0 : intval($aParam['p_article_id']);
try {
$result = (new ReferenceCheckService())->enqueueRecheckFailedByPReferId($iPReferId, $iPArticleId);
return jsonSuccess([]);
} catch (\Exception $e) {
return jsonError($e->getMessage());
}
}
/**
* 按 p_refer_id 查单条参考文献的校对明细与进度
*
* POST/GET: p_refer_id必填
*
* 返回 list 中每项含am_id、confidence、reason、is_match、is_pass
* 同时附带上下文p_refer_id、p_article_id、reference_no、total
* 分组进度progress_status(0待/1中/2完成/3失败)、pending、done、failed、pass
* is_pass、progress_percent、last_updated_at
* list 每项check_id、am_id、status、confidence、reason、is_match、is_pass
*/
public function referenceCheckDetailsAI()
{