队列调整
This commit is contained in:
@@ -32,7 +32,7 @@ class Aireview extends Base
|
|||||||
|
|
||||||
//查询文章
|
//查询文章
|
||||||
$aWhere = ['article_id' => $aParam['article_id']];
|
$aWhere = ['article_id' => $aParam['article_id']];
|
||||||
$aArticle = Db::name('article')->field('article_id,abstrart,keywords,journal_id')->where('article_id',$aParam['article_id'])->find();
|
$aArticle = Db::name('article')->field('article_id,abstrart,keywords,journal_id,title,state')->where('article_id',$aParam['article_id'])->find();
|
||||||
if(empty($aArticle)){
|
if(empty($aArticle)){
|
||||||
return json_encode(array('status' => 3,'msg' => 'No articles requiring review were found' ));
|
return json_encode(array('status' => 3,'msg' => 'No articles requiring review were found' ));
|
||||||
}
|
}
|
||||||
@@ -50,24 +50,36 @@ class Aireview extends Base
|
|||||||
|
|
||||||
//实例化公共方法
|
//实例化公共方法
|
||||||
$oOpenAi = new OpenAi;
|
$oOpenAi = new OpenAi;
|
||||||
|
if($aArticle['state'] > 4 ){
|
||||||
//查询文章内容
|
//查询文章内容
|
||||||
$aWhere['type'] = 0;
|
$aWhere['type'] = 0;
|
||||||
$aWhere['content'] = ['<>',''];
|
$aWhere['content'] = ['<>',''];
|
||||||
$aWhere['state'] = 0;
|
$aWhere['state'] = 0;
|
||||||
$aArticleMain = Db::table('t_article_main')->where($aWhere)->column('content');
|
$aArticleMain = Db::table('t_article_main')->where($aWhere)->column('content');
|
||||||
if(empty($aArticleMain)){//读取文件内容
|
//查询参考文献
|
||||||
|
$aWhere = ['state' => ['in',[0,2]],'article_id' => $iArticleId];
|
||||||
|
$aProductionArticle = Db::name('production_article')->field('p_article_id')->where($aWhere)->find();
|
||||||
|
if(!empty($aProductionArticle)){
|
||||||
|
$aWhere = ['state' => 0,'p_article_id' => $aProductionArticle['p_article_id']];
|
||||||
|
$aRefer = Db::name('production_article_refer')->field('refer_content')->where($aWhere)->column('refer_content');
|
||||||
|
$aArticleMain = empty($aRefer) ? $aArticleMain : array_merge($aRefer,$aArticleMain);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
|
||||||
$aFile = json_decode($oOpenAi->getFileContent(['article_id' => $iArticleId]),true);
|
$aFile = json_decode($oOpenAi->getFileContent(['article_id' => $iArticleId]),true);
|
||||||
$aFile = empty($aFile['data']) ? [] : $aFile['data'];
|
$aFile = empty($aFile['data']) ? [] : $aFile['data'];
|
||||||
$aArticleMain = empty($aFile['mains']) ? [] : $aFile['mains'];
|
$aArticleMain = empty($aFile['mains']) ? [] : $aFile['mains'];
|
||||||
}
|
}
|
||||||
//获取提问AI的内容
|
//获取提问AI的内容
|
||||||
$aSearch = [];
|
$aSearch = [];
|
||||||
|
$title = empty($aArticle['title']) ? '' : $aArticle['title'];//简介
|
||||||
$abstrart = empty($aArticle['abstrart']) ? '' : $aArticle['abstrart'];//简介
|
$abstrart = empty($aArticle['abstrart']) ? '' : $aArticle['abstrart'];//简介
|
||||||
$keywords = empty($aArticle['keywords']) ? '' : $aArticle['keywords'];//关键词
|
$keywords = empty($aArticle['keywords']) ? '' : $aArticle['keywords'];//关键词
|
||||||
$sContent = empty($aArticleMain) ? '' : strip_tags(implode('', array_unique($aArticleMain)),'<img>');//文章内容
|
//文章内容
|
||||||
if(empty(trim($sContent))){
|
$sContent = '文章标题:'.$title.'文章摘要:'.$abstrart.'文章关键词:'.$keywords."文章内容";
|
||||||
$sContent = '摘要:'.$abstrart.'关键词:'.$keywords;
|
$sContent .= empty($aArticleMain) ? '' : implode('', array_unique($aArticleMain));
|
||||||
}
|
$sContent = preg_replace('/[\r\n]+/', '', $sContent);
|
||||||
|
$sContent = preg_replace('/ +/', ' ', $sContent); // 合并连续空格
|
||||||
$aSearch['{content}'] = $sContent;
|
$aSearch['{content}'] = $sContent;
|
||||||
$aSearch['{journal_name}'] = empty($aJournal['zname']) ? '' : $aJournal['zname'];//期刊名
|
$aSearch['{journal_name}'] = empty($aJournal['zname']) ? '' : $aJournal['zname'];//期刊名
|
||||||
if($aJournal['journal_id'] == 1){
|
if($aJournal['journal_id'] == 1){
|
||||||
@@ -75,11 +87,12 @@ class Aireview extends Base
|
|||||||
}
|
}
|
||||||
//查询期刊内容
|
//查询期刊内容
|
||||||
$aJournalPaperArt = json_decode($oOpenAi->getJournalPaperArt($aJournal),true);
|
$aJournalPaperArt = json_decode($oOpenAi->getJournalPaperArt($aJournal),true);
|
||||||
$sJournalContent = empty($aJournalPaperArt['data']) ? '' : strip_tags(implode('', $aJournalPaperArt['data']));
|
$sJournalContent = empty($aJournalPaperArt['data']) ? '' : implode('', $aJournalPaperArt['data']);
|
||||||
|
$sJournalContent = preg_replace('/[\r\n]+/', '', $sJournalContent);
|
||||||
|
$sJournalContent = preg_replace('/ +/', ' ', $sJournalContent); // 合并连续空格
|
||||||
|
$sJournalContent = strip_tags($sJournalContent);
|
||||||
$sJournalContent = empty($sJournalContent) ? $aJournal['scope'] : $sJournalContent;
|
$sJournalContent = empty($sJournalContent) ? $aJournal['scope'] : $sJournalContent;
|
||||||
$aSearch['{scope}'] = $sJournalContent;//期刊范围
|
$aSearch['{scope}'] = $sJournalContent;//期刊范围
|
||||||
//获取问答内容
|
|
||||||
$oOpenAi = new OpenAi;
|
|
||||||
$aMessage = $oOpenAi->buildReviewArticlePrompt($aSearch);
|
$aMessage = $oOpenAi->buildReviewArticlePrompt($aSearch);
|
||||||
if(empty($aMessage)){
|
if(empty($aMessage)){
|
||||||
return json_encode(['status' => 5,'msg' => 'AI Q&A content not obtained']);
|
return json_encode(['status' => 5,'msg' => 'AI Q&A content not obtained']);
|
||||||
@@ -118,7 +131,7 @@ class Aireview extends Base
|
|||||||
//返回数组
|
//返回数组
|
||||||
$aResult = ['status' => 1,'msg' => 'AI review successful'];
|
$aResult = ['status' => 1,'msg' => 'AI review successful'];
|
||||||
//必填参数验证
|
//必填参数验证
|
||||||
$aFields = ['journal_scope','attribute','contradiction','unreasonable','ethics','academic','conclusion','fund_number','hotspot','submit_direction','overall_evaluation','article_id','references_past_three','references_past_five','references_ratio_JCR1','references_ratio_JCR2','registration_assessment','cite_rate'];
|
$aFields = ['journal_scope','attribute','contradiction','unreasonable','ethics','academic','conclusion','fund_number','hotspot','submit_direction','overall_evaluation','article_id','references_past_three','references_past_five','references_ratio_JCR1','references_ratio_JCR2','registration_assessment','cite_rate','references_num'];
|
||||||
$aInsert = ['create_time' => date('Y-m-d H:i:s')];
|
$aInsert = ['create_time' => date('Y-m-d H:i:s')];
|
||||||
foreach($aFields as $val){
|
foreach($aFields as $val){
|
||||||
$aValue = empty($aParam[$val]) ? [] : $aParam[$val];
|
$aValue = empty($aParam[$val]) ? [] : $aParam[$val];
|
||||||
|
|||||||
Reference in New Issue
Block a user