This commit is contained in:
wangjinlei
2020-12-07 14:25:31 +08:00
parent 63c7fe6111
commit efbe9e40db
2 changed files with 134 additions and 6 deletions

View File

@@ -18,6 +18,7 @@ class Journal extends Controller {
protected $article_author_obj = '';
protected $journal_topic_obj = '';
protected $journal_stage_obj = '';
protected $journal_notices_obj = '';
protected $journal_abs_obj = '';
protected $article_to_topic_obj = '';
@@ -29,6 +30,7 @@ class Journal extends Controller {
$this->article_author_obj = Db::name('article_author');
$this->journal_topic_obj = Db::name('journal_topic');
$this->journal_stage_obj = Db::name('journal_stage');
$this->journal_notices_obj = Db::name('journal_notices');
$this->journal_abs_obj = Db::name('journal_abstracting');
$this->article_to_topic_obj = Db::name('article_to_topic');
}
@@ -170,7 +172,12 @@ class Journal extends Controller {
public function getOnlineArticle(){
$data = $this->request->post();
$stages = $this->journal_stage_obj->where('journal_id',$data['journal_id'])->where('is_publish',0)->where('state',0)->column('journal_stage_id');
$list = $this->article_obj->field('j_article.*,j_journal_stage.stage_year stage_year')->join('j_journal_stage','j_article.journal_stage_id = j_journal_stage.journal_stage_id','LEFT')->where('j_article.journal_stage_id','in',$stages)->where('j_article.state',0)->select();
$list = $this->article_obj
->field('j_article.*,j_journal_stage.stage_year stage_year')
->join('j_journal_stage','j_article.journal_stage_id = j_journal_stage.journal_stage_id','LEFT')
->where('j_article.journal_stage_id','in',$stages)
->where('j_article.state',0)
->select();
return json(['code'=>0,'msg'=>'success','data'=>['articlelist'=>$list]]);
}
@@ -187,14 +194,56 @@ class Journal extends Controller {
*/
public function getNewsArticle(){
$data = $this->request->post();
$stages = $this->journal_stage_obj->where('journal_id',$data['journal_id'])->where('is_publish',0)->where('state',0)->column('journal_stage_id');
$stages = $this->journal_stage_obj->where('journal_id',$data['journal_id'])->where('is_publish',1)->where('state',0)->column('journal_stage_id');
$list = $this->article_obj
->where('journal_stage_id','in',$stages)
->where('state',0)
->where('type',['like','News'],['like','Comment'],'or')
->order('article_id')
->field('j_article.*,j_journal_stage.stage_year stage_year')
->join('j_journal_stage','j_article.journal_stage_id = j_journal_stage.journal_stage_id','LEFT')
->where('j_article.journal_stage_id','in',$stages)
->where('j_article.state',0)
->where('j_article.type',['like','News'],['like','Comment'],'or')
->order('j_article.article_id')
->select();
return json(['code'=>0,'msg'=>'success','data'=>['articlelist'=>$list]]);
}
/**
* @title 获取消息列表
* @description 获取消息列表
* @author wangjinlei
* @url /api/Journal/getNotices
* @method POST
*
* @param name:journal_id type:int require:1 desc:期刊id
*
* @return notices:消息列表array#
*/
public function getNotices(){
$data = $this->request->post();
$list = $this->journal_notices_obj->where('journal_id',$data['journal_id'])->where('state',0)->select();
return jsonSuccess(['notices'=>$list]);
}
/**
* @title 获取话题文章
* @description 获取话题文章
* @author wangjinlei
* @url /api/Journal/getTopicArticle
* @method POST
*
* @param name:journal_topic_id type:int require:1 desc:期刊话题id
*
* @return topic_info:话题详情
* @return articlelist:文章列表array#
*/
public function getTopicArticle(){
$data = $this->request->post();
$topic_info = $this->journal_topic_obj->where('journal_topic_id',$data['journal_topic_id'])->find();
$list = $this->article_to_topic_obj->field('j_article.*')
->join('j_article','j_article.article_id = j_article_to_topic.article_id','LEFT')
->where('j_article_to_topic.topic_id',$data['journal_topic_id'])
->where('j_article_to_topic.state',0)
->select();
return json(['code'=>0,'msg'=>'success','data'=>['topic_info'=>$topic_info,'articlelist'=>$list]]);
}
}