参考文献作者堆叠
参考文献相关性检测 作者ai写作辅助检测工作
This commit is contained in:
@@ -21,4 +21,10 @@ class RabbitMqConfig
|
||||
$rc = self::get('reference_check', []);
|
||||
return is_array($rc) ? $rc : [];
|
||||
}
|
||||
|
||||
public static function aiWritingRisk()
|
||||
{
|
||||
$cfg = self::get('ai_writing_risk', []);
|
||||
return is_array($cfg) ? $cfg : [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,11 @@ class ReferenceCheckArticleWorker
|
||||
|
||||
if (!$this->claimBatch($batchId)) {
|
||||
$batch = $this->getBatch($batchId);
|
||||
if (empty($batch) || intval($batch['batch_status']) === self::BATCH_DONE) {
|
||||
// 已被其他消费者领取或已结束,当前消息直接跳过,避免同批次并发重复执行
|
||||
if (empty($batch)
|
||||
|| intval($batch['batch_status']) === self::BATCH_RUNNING
|
||||
|| intval($batch['batch_status']) === self::BATCH_DONE
|
||||
|| intval($batch['batch_status']) === self::BATCH_PARTIAL_FAILED) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -100,7 +104,8 @@ class ReferenceCheckArticleWorker
|
||||
$now = date('Y-m-d H:i:s');
|
||||
$affected = Db::name('article_reference_relevance_check_batch')
|
||||
->where('id', intval($batchId))
|
||||
->whereIn('batch_status', [self::BATCH_WAITING, self::BATCH_RUNNING])
|
||||
// 只允许 WAITING -> RUNNING,禁止已 RUNNING 的批次被重复 claim
|
||||
->where('batch_status', self::BATCH_WAITING)
|
||||
->update([
|
||||
'batch_status' => self::BATCH_RUNNING,
|
||||
'updated_at' => $now,
|
||||
@@ -145,12 +150,14 @@ class ReferenceCheckArticleWorker
|
||||
} catch (\Exception $e) {
|
||||
$this->svc->log('ReferenceCheckArticleWorker check_id=' . $checkId . ' err=' . $e->getMessage());
|
||||
DbReconnectHelper::ensure();
|
||||
if ($retryCount < ReferenceRelevanceCheckService::QUEUE_MAX_RETRY) {
|
||||
$this->svc->markQueueRuntime($checkId, ReferenceRelevanceCheckService::QUEUE_PENDING, $retryCount + 1);
|
||||
return $this->processOneRow($checkId, array_merge($row, ['retry_count' => $retryCount + 1]), $skipLiteratureFetch);
|
||||
}
|
||||
try {
|
||||
$fresh = Db::name('article_reference_relevance_check_result')->where('id', intval($checkId))->find();
|
||||
if (!empty($fresh) && intval($fresh['status']) === ReferenceRelevanceCheckService::RECORD_FAILED) {
|
||||
if (intval($fresh['queue_status']) !== ReferenceRelevanceCheckService::QUEUE_FAILED) {
|
||||
$this->svc->markQueueRuntime($checkId, ReferenceRelevanceCheckService::QUEUE_FAILED, $retryCount);
|
||||
}
|
||||
return 'failed';
|
||||
}
|
||||
$groupRows = !empty($fresh) ? $this->svc->findCitationGroupRowsForWorker($fresh) : [];
|
||||
if (!empty($groupRows)) {
|
||||
$this->svc->failGroupWithQueue($groupRows, $e->getMessage(), $retryCount);
|
||||
|
||||
Reference in New Issue
Block a user