参考文献校对升级
This commit is contained in:
@@ -7,7 +7,7 @@ use think\Env;
|
||||
use think\Queue;
|
||||
use think\Validate;
|
||||
use app\common\CrossrefService;
|
||||
use app\common\ReferenceCheckService;
|
||||
use app\common\ReferenceRelevanceCheckService;
|
||||
|
||||
class Preaccept extends Base
|
||||
{
|
||||
@@ -27,7 +27,7 @@ class Preaccept extends Base
|
||||
return;
|
||||
}
|
||||
try {
|
||||
(new ReferenceCheckService())->clearArticleChecksByPArticleId($pArticleId);
|
||||
(new ReferenceRelevanceCheckService())->clearArticleChecksByPArticleId($pArticleId);
|
||||
} catch (\Exception $e) {
|
||||
\think\Log::error(
|
||||
'resetArticleChecksOnReferChange[' . $sourceTag . '] p_article_id='
|
||||
@@ -1220,6 +1220,14 @@ class Preaccept extends Base
|
||||
$insert['ctime'] = time();
|
||||
$this->article_main_log_obj->insert($insert);
|
||||
|
||||
// $articleId = intval($am_info['article_id']);
|
||||
// $amId = intval($data['am_id']);
|
||||
//
|
||||
// // 本段引用集合变化(如 10,11 → 11,12)时仅清空该 am_id 下的校对明细
|
||||
// if ($this->hasMainCitationChange($old_content, $new_raw_content, $articleId)) {
|
||||
// $this->clearMainChecksOnCitationChange($articleId, $amId);
|
||||
// }
|
||||
|
||||
// 判断是否存在“引用删除”(新 content 相对旧 content 缺少 <mycite>)
|
||||
$hasCitationDeletion = $this->hasMyciteDeletion($old_content, $new_raw_content);
|
||||
|
||||
@@ -1245,6 +1253,39 @@ class Preaccept extends Base
|
||||
//返回更新数据 20260119 end
|
||||
}
|
||||
|
||||
/**
|
||||
* 正文单节保存后,仅清空该 am_id 下已有的引用校对明细(按 article_id 定位)。
|
||||
*/
|
||||
private function clearMainChecksOnCitationChange(int $articleId, int $amId)
|
||||
{
|
||||
if ($articleId <= 0 || $amId <= 0) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
(new ReferenceCheckService())->clearChecksByAmId($articleId, $amId);
|
||||
} catch (\Exception $e) {
|
||||
\think\Log::error(
|
||||
'clearMainChecksOnCitationChange article_id=' . $articleId
|
||||
. ' am_id=' . $amId . ' ' . $e->getMessage()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 本段正文引用集合是否变化(增删改任一即 true)。
|
||||
* old 多为库内 <blue>[n]</blue>,new 多为编辑器提交的 <mycite data-id="p_refer_id">。
|
||||
*/
|
||||
private function hasMainCitationChange(string $oldContent, string $newContent, int $articleId): bool
|
||||
{
|
||||
$pArticleId = intval(Db::name('production_article')
|
||||
->where('article_id', $articleId)
|
||||
->whereIn('state', [0, 2])
|
||||
->value('p_article_id'));
|
||||
$oldNos = $this->extractCitationRefNosFromMainContent($oldContent, $pArticleId);
|
||||
$newNos = $this->extractCitationRefNosFromMainContent($newContent, $pArticleId);
|
||||
return $oldNos !== $newNos;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否发生 <mycite> 删除(new 相对 old 少了任意引用 id)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user