新增获取文章底部信息方法
This commit is contained in:
@@ -66,6 +66,66 @@ class Supplementary extends Base
|
|||||||
}
|
}
|
||||||
return json_encode(['status' => 1,'msg' => 'success','data' => $aUserData]);
|
return json_encode(['status' => 1,'msg' => 'success','data' => $aUserData]);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @title 获取文章底部信息
|
||||||
|
* @description 获取期刊编辑接口
|
||||||
|
*/
|
||||||
|
public function getProductiArticleFooter(){
|
||||||
|
|
||||||
|
$aParam = $this->request->post();
|
||||||
|
|
||||||
|
//官网文章ID
|
||||||
|
$iWarticleId = empty($aParam['w_article_id']) ? 0 : $aParam['w_article_id'];
|
||||||
|
if(empty($iWarticleId)){
|
||||||
|
return json_encode(['status' => 2,'msg' => 'Please select an article']);
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取子刊信息
|
||||||
|
$aJournalStage = empty($aParam['journal_stage']) ? [] : $aParam['journal_stage'];
|
||||||
|
|
||||||
|
//查询文章生产信息
|
||||||
|
$aWhere = ['w_article_id' => $iWarticleId,'state' => ['in',[0,2]]];
|
||||||
|
$aProductionArticle = Db::name('production_article')->field('p_article_id,article_id,journal_stage_id,journal_id,title,type,acknowledgment,abbreviation,author_contribution,abbr,npp,doi,executive_editor')->where($aWhere)->find();
|
||||||
|
if(empty($aProductionArticle)){
|
||||||
|
return json_encode(['status' => 3,'msg' => 'No production article information found']);
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询期刊信息
|
||||||
|
$iJournalId = empty($aProductionArticle['journal_id']) ? 0 : $aProductionArticle['journal_id'];
|
||||||
|
$aJournal = [];
|
||||||
|
if(!empty($iJournalId)){
|
||||||
|
$aWhere = ['journal_id' => $iJournalId,'state' => 0];
|
||||||
|
$aJournal = Db::name('journal')->field('jabbr,title')->where($aWhere)->find();
|
||||||
|
}
|
||||||
|
//获取文章时间/编委信息
|
||||||
|
$iArticleId = empty($aProductionArticle['article_id']) ? 0 : $aProductionArticle['article_id'];
|
||||||
|
if(empty($iArticleId)){
|
||||||
|
return json_encode(['status' => 3,'msg' => 'No article information found']);
|
||||||
|
}
|
||||||
|
$oLatexContent = new \app\common\LatexContent;
|
||||||
|
$aTime = $oLatexContent->getArticleTime(['article_id' => $iArticleId]);
|
||||||
|
$aProductionArticle = empty($aTime['data']) ? $aProductionArticle : array_merge($aTime['data'],$aProductionArticle);
|
||||||
|
|
||||||
|
//获取期刊引用信息
|
||||||
|
$sCite = $this->_cite($aProductionArticle,$aJournal,$aJournalStage);
|
||||||
|
$aProductionArticle['article_cite'] = empty($sCite) ? '' : $sCite;
|
||||||
|
$aProductionArticle['journal_title'] = empty($aJournal['title']) ? '' : $aJournal['title'];
|
||||||
|
return json_encode(['status' => 1,'data' => $aProductionArticle]);
|
||||||
|
}
|
||||||
|
//处理期刊引用信息
|
||||||
|
private function _cite($aArticle = [],$aJournal = [],$aJournalStage = []){
|
||||||
|
$no = empty($aJournalStage['stage_no']) ? ':' : '(' . $aJournalStage['stage_no'] . '):';
|
||||||
|
$jabbr = empty($aJournal['jabbr']) ? '' : $aJournal['jabbr'];
|
||||||
|
$stage_year = empty($aJournalStage['stage_year']) ? '' : $aJournalStage['stage_year'];
|
||||||
|
$stage_vol = empty($aJournalStage['stage_vol']) ? '' : $aJournalStage['stage_vol'];
|
||||||
|
|
||||||
|
$sCite = '';
|
||||||
|
if ($aArticle['journal_id'] == 22) {
|
||||||
|
$sCite = $aArticle['abbr'] . '. ' . $aArticle['title'] . '[J]. ' . choiseJabbr($aArticle['article_id'],$jabbr) . ',' . $stage_year . ',' . $stage_vol . $no . $aArticle['npp'] . '. doi:' . $aArticle['doi'];
|
||||||
|
} else {
|
||||||
|
$sCite = $aArticle['abbr'] . '. ' . $aArticle['title'] . '. <i>' . choiseJabbr($aArticle['article_id'], $jabbr) . '</i>. ' . $stage_year . ';' . $stage_vol . $no . $aArticle['npp'] . '. doi:' . $aArticle['doi'];
|
||||||
|
}
|
||||||
|
return $sCite;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
Reference in New Issue
Block a user