This commit is contained in:
wangjinlei
2020-12-24 15:14:02 +08:00
parent c7ef740a13
commit 096cb1e571
4 changed files with 261 additions and 16 deletions

View File

@@ -23,7 +23,9 @@ class Journal extends Controller {
protected $journal_notices_obj = '';
protected $journal_abs_obj = '';
protected $journal_cfp_obj = '';
protected $journal_line_obj = '';
protected $article_to_topic_obj = '';
protected $article_to_line_obj = '';
protected $journal_paper_obj = '';
protected $journal_paper_art_obj = '';
@@ -39,7 +41,9 @@ class Journal extends Controller {
$this->journal_notices_obj = Db::name('journal_notices');
$this->journal_abs_obj = Db::name('journal_abstracting');
$this->journal_cfp_obj = Db::name('journal_cfp');
$this->journal_line_obj = Db::name('journal_line');
$this->article_to_topic_obj = Db::name('article_to_topic');
$this->article_to_line_obj = Db::name('article_to_line');
$this->journal_paper_obj = Db::name('journal_paper');
$this->journal_paper_art_obj = Db::name('journal_paper_art');
}
@@ -82,7 +86,7 @@ class Journal extends Controller {
public function getJournal() {
$data = $this->request->post();
$journal_info = $this->journal_obj->where('journal_id', $data['journal_id'])->find();
$absList = $this->journal_abs_obj->where('journal_id', $data['journal_id'])->where('state', 0)->order('journal_abstracting_id')->select();
$absList = $this->journal_abs_obj->where('journal_id', $data['journal_id'])->where('state', 0)->order('sort')->select();
$stageList = $this->journal_stage_obj->where('journal_id', $data['journal_id'])->where('is_publish', 1)->where('state', 0)->order('journal_stage_id desc')->select();
return json(['code' => 0, 'msg' => 'success', 'data' => ['journal' => $journal_info, 'journalAbs' => $absList, 'journalStage' => $stageList]]);
}
@@ -128,6 +132,65 @@ class Journal extends Controller {
}
return $vv;
}
/**
* @title 获取期刊line
* @description 获取期刊line
* @author wangjinlei
* @url /api/Journal/getJournalLine
* @method POST
*
* @param name:journal_id type:int require:1 desc:期刊id
*
* @return lines:期刊line数组#
*/
public function getJournalLine(){
$data = $this->request->post();
$list = $this->journal_line_obj->where('journal_id',$data['journal_id'])->where('state',0)->order('journal_line_id')->select();
$re['lines'] = $list;
return jsonSuccess($re);
}
/**
* @title 获取期刊line文章
* @description 获取期刊line文章
* @author wangjinlei
* @url /api/Journal/getJournalLineArt
* @method POST
*
* @param name:journal_line_id type:int require:1 desc:期刊lineid
*
* @return journalLine:期刊时间线信息#
* @return articles:期刊line文章数组#
*/
public function getJournalLineArt(){
$data = $this->request->post();
$journalLine = $this->journal_line_obj->where('journal_line_id',$data['journal_line_id'])->find();
$list = $this->article_to_line_obj->field('j_article.*,j_journal_stage.*')
->join([['j_article','j_article_to_line.article_id = j_article.article_id','LEFT'],['j_journal_stage','j_journal_stage.journal_stage_id = j_article.journal_stage_id','LEFT']])
->where('j_article_to_line.journal_line_id',$data['journal_line_id'])
->where('j_article_to_line.state',0)
->select();
//标题斜体
foreach ($list as $k => $v) {
$caches = $this->article_ltai_obj->where('article_id', $v['article_id'])->where('state', 0)->column('content');
$cache_title = $v['title'];
foreach ($caches as $val) {
$cache_title = str_replace($val, '<i>' . $val . '</i>', $cache_title);
}
$list[$k]['title'] = $cache_title;
}
//获取作者
foreach ($list as $k => $v) {
$list[$k]['authortitle'] = $this->getAuthor($v);
}
$re['journalLine'] = $journalLine;
$re['articles'] = $list;
return jsonSuccess($re);
}
/**
* @title 获取期刊推广文章
@@ -149,14 +212,6 @@ class Journal extends Controller {
->order('sort asc')
->select();
$stage_info = $this->journal_stage_obj->where('journal_stage_id', $journal_info['publish_stage_id'])->find();
//获取作者
foreach ($list as $k => $v) {
//组合cite信息
$no = $stage_info['stage_no'] == 0 ? ':' : '(' . $stage_info['stage_no'] . '):';
$cite = $v['abbr'] . '. ' . $v['title'] . '. <i>' . $journal_info['jabbr'] . '</i>. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi'];
$list[$k]['cite'] = $cite;
$list[$k]['authortitle'] = $this->getAuthor($v);
}
//标题斜体
foreach ($list as $k => $v) {
$caches = $this->article_ltai_obj->where('article_id', $v['article_id'])->where('state', 0)->column('content');
@@ -166,6 +221,16 @@ class Journal extends Controller {
}
$list[$k]['title'] = $cache_title;
}
//获取作者
foreach ($list as $k => $v) {
//组合cite信息
$no = $stage_info['stage_no'] == 0 ? ':' : '(' . $stage_info['stage_no'] . '):';
$cite = $v['abbr'] . '. ' . $v['title'] . '. <i>' . $journal_info['jabbr'] . '</i>. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi'];
$list[$k]['cite'] = $cite;
$list[$k]['authortitle'] = $this->getAuthor($v);
}
return json(['code' => 0, 'msg' => 'success', 'data' => ['stage' => $stage_info, 'articleList' => $list]]);
}
private function getAuthor($article) {