20201112
This commit is contained in:
@@ -53,9 +53,96 @@ class Journal extends Controller {
|
||||
return json(['code'=>0,'msg'=>'success','data'=>['journalList'=>$res]]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取期刊信息
|
||||
* @description 获取期刊信息
|
||||
* @author wangjinlei
|
||||
* @url /api/Journal/getJournal
|
||||
* @method POST
|
||||
*
|
||||
* @param name:journal_id type:int require:1 desc:期刊id
|
||||
*
|
||||
* @return journal:期刊基础信息array#
|
||||
* @return journalAbs:期刊外链信息array#
|
||||
* @return journalstage:期刊分期信息array#
|
||||
*/
|
||||
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();
|
||||
$stageList = $this->journal_stage_obj->where('journal_id',$data['journal_id'])->where('is_publish',1)->where('state',0)->order('journal_stage_id')->select();
|
||||
return json(['code'=>0,'msg'=>'success','data'=>['journal'=>$journal_info,'journalAbs'=>$absList,'journalStage'=>$stageList]]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取期刊话题
|
||||
* @description 获取期刊话题
|
||||
* @author wangjinlei
|
||||
* @url /api/Journal/getJournalTopic
|
||||
* @method POST
|
||||
*
|
||||
* @param name:journal_id type:int require:1 desc:期刊id
|
||||
*
|
||||
* @return topicList:期刊话题列表array#
|
||||
*/
|
||||
public function getJournalTopic(){
|
||||
$data = $this->request->post();
|
||||
$res = $this->journal_topic_obj
|
||||
->where('journal_id',$data['journal_id'])
|
||||
->where('state',0)
|
||||
->select();
|
||||
//处理数组
|
||||
$frag = [];
|
||||
foreach ($res as $v){
|
||||
if($v['parent_id'] == 0){
|
||||
$frag[] = $v;
|
||||
}
|
||||
}
|
||||
foreach ($frag as $kk => $vv){
|
||||
$frag[$kk] = $this->getChieldarr($vv,$res);
|
||||
}
|
||||
return json(['code'=>0,'msg'=>'success','data'=>['topicList'=>$frag]]);
|
||||
}
|
||||
private function getChieldarr($vv,$res){
|
||||
if($vv['is_final']==1){
|
||||
return $vv;
|
||||
}
|
||||
foreach ($res as $v){
|
||||
if($v['parent_id'] == $vv['journal_topic_id']){
|
||||
$vv['children'][] = $this->getChieldarr($v, $res);
|
||||
}
|
||||
}
|
||||
return $vv;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @title 获取期刊推广文章
|
||||
* @description 获取期刊推广文章
|
||||
* @author wangjinlei
|
||||
* @url /api/Journal/getJournalTopic
|
||||
* @method POST
|
||||
*
|
||||
* @param name:journal_id type:int require:1 desc:期刊id
|
||||
*
|
||||
* @return articleList:期刊话题列表array#
|
||||
*/
|
||||
public function getJournalArticles(){
|
||||
$data = $this->request->post();
|
||||
$journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find();
|
||||
$list = $this->article_obj->where('journal_stage_id',$journal_info['publish_stage_id'])
|
||||
->where('state',0)
|
||||
->order('article_id desc')
|
||||
->select();
|
||||
// $publish_list = $this->journal_stage_obj->where('journal_id',$data['journal_id'])->column('journal_stage_id');
|
||||
// $list = $this->article_obj
|
||||
// ->where('journal_id',$data['journal_id'])
|
||||
// ->where('state',0)
|
||||
// ->where('journal_stage_id','in',$publish_list)
|
||||
// ->order('article_id desc')
|
||||
// ->limit(10)
|
||||
// ->select();
|
||||
return json(['code'=>0,'msg'=>'success','data'=>['articleList'=>$list]]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user