参考文献优化
This commit is contained in:
@@ -205,11 +205,10 @@ class ReferenceRelevanceCheckService
|
||||
}
|
||||
|
||||
/**
|
||||
* 仅重新校对某篇文章下 status=3(失败)的记录;不刷新 refer_text / 文献摘要,只重置结果字段后入队。
|
||||
* 联合引用组会整组重跑(与 enqueueRecheckFailedByPReferIdWithGroup 一致)。
|
||||
* 仅重新校对某篇文章下 status=3(失败)的记录:先将 status 重置为 0,其余与 recheckPendingOnlyByArticle 相同。
|
||||
*
|
||||
* @param int $pArticleId
|
||||
* @return array{p_article_id:int,reset:int,queued:int,check_ids:int[],transport:string,queue:string}
|
||||
* @return array{p_article_id:int,queued:int,check_ids:int[],transport:string,queue:string}
|
||||
*/
|
||||
public function recheckFailedOnlyByArticle($pArticleId)
|
||||
{
|
||||
@@ -222,12 +221,12 @@ class ReferenceRelevanceCheckService
|
||||
$rows = Db::name('article_reference_relevance_check_result')
|
||||
->where('p_article_id', $pArticleId)
|
||||
->where('status', self::RECORD_FAILED)
|
||||
->field('id,reference_no,am_id,text_start')
|
||||
->order('reference_no asc,am_id asc,text_start asc,id asc')
|
||||
->select();
|
||||
if (empty($rows)) {
|
||||
return [
|
||||
'p_article_id' => $pArticleId,
|
||||
'reset' => 0,
|
||||
'queued' => 0,
|
||||
'check_ids' => [],
|
||||
'transport' => self::TRANSPORT_RABBITMQ,
|
||||
@@ -235,26 +234,14 @@ class ReferenceRelevanceCheckService
|
||||
];
|
||||
}
|
||||
|
||||
$now = date('Y-m-d H:i:s');
|
||||
$resetFields = $this->relevanceCheckResultResetFields([
|
||||
'updated_at' => $now,
|
||||
]);
|
||||
|
||||
$targetRows = [];
|
||||
foreach ($rows as $row) {
|
||||
$groupRows = $this->findCitationGroupRows($row);
|
||||
foreach ($groupRows as $gr) {
|
||||
$checkId = $this->resolveCheckRowId($gr);
|
||||
if ($checkId > 0) {
|
||||
$targetRows[$checkId] = $gr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$pendingJobs = [];
|
||||
foreach ($targetRows as $row) {
|
||||
$checkId = $this->resolveCheckRowId($row);
|
||||
Db::name('article_reference_relevance_check_result')->where('id', $checkId)->update($resetFields);
|
||||
$checkIds = [];
|
||||
foreach ($rows as $row) {
|
||||
$checkId = intval($row['id']);
|
||||
if ($checkId <= 0) {
|
||||
continue;
|
||||
}
|
||||
$checkIds[] = $checkId;
|
||||
$pendingJobs[] = [
|
||||
'check_id' => $checkId,
|
||||
'reference_no' => intval($row['reference_no']),
|
||||
@@ -262,14 +249,32 @@ class ReferenceRelevanceCheckService
|
||||
'text_start' => intval($row['text_start']),
|
||||
];
|
||||
}
|
||||
if (empty($checkIds)) {
|
||||
return [
|
||||
'p_article_id' => $pArticleId,
|
||||
'queued' => 0,
|
||||
'check_ids' => [],
|
||||
'transport' => self::TRANSPORT_RABBITMQ,
|
||||
'queue' => self::TRANSPORT_RABBITMQ,
|
||||
];
|
||||
}
|
||||
|
||||
$checkIds = $this->enqueueChecksSortedByReferenceNo($pendingJobs, $pArticleId, 'recheck_failed');
|
||||
Db::name('article_reference_relevance_check_result')
|
||||
->whereIn('id', $checkIds)
|
||||
->update([
|
||||
'status' => self::RECORD_PENDING,
|
||||
'queue_status' => self::QUEUE_PENDING,
|
||||
'retry_count' => 0,
|
||||
'error_msg' => '',
|
||||
'updated_at' => date('Y-m-d H:i:s'),
|
||||
]);
|
||||
|
||||
$queuedIds = $this->enqueueChecksSortedByReferenceNo($pendingJobs, $pArticleId, 'recheck_failed');
|
||||
|
||||
return [
|
||||
'p_article_id' => $pArticleId,
|
||||
'reset' => count($targetRows),
|
||||
'queued' => count($checkIds),
|
||||
'check_ids' => $checkIds,
|
||||
'queued' => count($queuedIds),
|
||||
'check_ids' => $queuedIds,
|
||||
'transport' => self::TRANSPORT_RABBITMQ,
|
||||
'queue' => self::TRANSPORT_RABBITMQ,
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user