拆分调整
This commit is contained in:
@@ -45,7 +45,7 @@ class Aireview extends Base
|
||||
if(empty($aArticle)){
|
||||
return json_encode(array('status' => 3,'msg' => 'No articles requiring review were found' ));
|
||||
}
|
||||
// //AI审稿信息
|
||||
//AI审稿信息
|
||||
$aAiReview = empty($aResult['data']) ? [] : $aResult['data'];
|
||||
if(!empty($aAiReview['is_finish']) && $aAiReview['is_finish'] == 1){
|
||||
return json_encode(array('status' => 1,'msg' => 'AI has been reviewed','data' => $aAiReview));
|
||||
@@ -125,6 +125,7 @@ class Aireview extends Base
|
||||
}
|
||||
}else{
|
||||
$aFile = json_decode($oArticle->getFileContent(['article_id' => $iArticleId]),true);
|
||||
|
||||
$aFile = empty($aFile['data']) ? [] : $aFile['data'];
|
||||
$aArticleMain = empty($aFile['mains']) ? [] : $aFile['mains'];
|
||||
}
|
||||
@@ -195,39 +196,21 @@ class Aireview extends Base
|
||||
return [];
|
||||
}
|
||||
|
||||
$pattern = '/<img\s+[^>]*?>/i';
|
||||
$sContent = preg_replace($pattern, '', $sContent);
|
||||
|
||||
// 关键修复:将分隔符从 / 改为 #,避免与 < > 冲突
|
||||
$pattern = '#<b>Reference</b>|<b>Reference:</b>|<b><i>References:</i></b>|<b><i>References</i></b>|<b>References</b>|<b>References:</b>#';
|
||||
|
||||
// 查找标识在文本中的位置
|
||||
preg_match($pattern, $sContent, $matches, PREG_OFFSET_CAPTURE);
|
||||
|
||||
if (empty($matches)) {
|
||||
// 未找到任何标识
|
||||
$before = $sContent;
|
||||
$after = '';
|
||||
} else {
|
||||
// 截取标识前后内容
|
||||
$marker = $matches[0][0];
|
||||
$markerStart = $matches[0][1];
|
||||
$before = substr($sContent, 0, $markerStart);
|
||||
$after = substr($sContent, $markerStart + strlen($marker));
|
||||
}
|
||||
if(empty($after)){
|
||||
$lastPos = strrpos($sContent, 'Reference');
|
||||
if ($lastPos === false) {
|
||||
//拆分字符串
|
||||
$lastPos = strrpos($sContent, 'Reference');
|
||||
if ($lastPos === false) {
|
||||
$lastPos = strrpos($sContent, 'REFERENCE');
|
||||
if($lastPos === false){
|
||||
// 未找到 "Reference",返回原字符串和空
|
||||
return [$sContent, ''];
|
||||
return ['before' => $sContent, 'after' => ''];
|
||||
}
|
||||
|
||||
// 拆分:关键词之前的内容
|
||||
$before = substr($sContent, 0, $lastPos);
|
||||
// 关键词及之后的内容(包含关键词本身)
|
||||
$after = substr($sContent, $lastPos);
|
||||
}
|
||||
return ['before' => $before,'after' => $after,'content' => $sContent];
|
||||
|
||||
// 拆分:关键词之前的内容
|
||||
$before = substr($sContent, 0, $lastPos);
|
||||
// 关键词及之后的内容(包含关键词本身)
|
||||
$after = substr($sContent, $lastPos);
|
||||
return ['before' => $before,'after' => $after];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user