From 1d569a3bd714417c43e898b3559b3696dac1c022 Mon Sep 17 00:00:00 2001 From: wangjinlei <751475802@qq.com> Date: Tue, 22 Jul 2025 13:38:43 +0800 Subject: [PATCH] 11 --- application/api/controller/Journal.php | 1101 +++++++++++++----------- application/api/controller/Main.php | 12 +- 2 files changed, 587 insertions(+), 526 deletions(-) diff --git a/application/api/controller/Journal.php b/application/api/controller/Journal.php index a038dfe..b81f371 100644 --- a/application/api/controller/Journal.php +++ b/application/api/controller/Journal.php @@ -12,7 +12,8 @@ use think\Validate; * @description 期刊web相关操作 * @group 期刊web相关 */ -class Journal extends Controller { +class Journal extends Controller +{ //put your code here protected $admin_obj = ''; @@ -42,7 +43,8 @@ class Journal extends Controller { protected $article_main_obj = ''; protected $article_cite_obj = ''; - public function __construct(\think\Request $request = null) { + public function __construct(\think\Request $request = null) + { parent::__construct($request); $this->admin_obj = Db::name('admin'); $this->journal_obj = Db::name('journal'); @@ -75,24 +77,25 @@ class Journal extends Controller { /** * @title 获取期刊列表 * @description 获取期刊列表 + * @return journalList:期刊列表@ + * @journalList title:标题 issn:issn editorinchief:editorinchief acceptance:acceptance finaldecision:finaldecision apc:apc * @author wangjinlei * @url /api/Journal/getJournalList * @method POST - * - * @return journalList:期刊列表@ - * @journalList title:标题 issn:issn editorinchief:editorinchief acceptance:acceptance finaldecision:finaldecision apc:apc + * */ - public function getJournalList() { + public function getJournalList() + { $res = $this->journal_obj - ->field('j_journal.*,j_admin.realname realname') - ->join('j_admin', 'j_admin.admin_id = j_journal.editor_id', 'LEFT') - ->where('j_journal.state',0) - ->where('journal_id','<>',13)//临时去掉25号新刊 - ->order(['j_journal.sort desc', 'j_journal.journal_id']) - ->select(); + ->field('j_journal.*,j_admin.realname realname') + ->join('j_admin', 'j_admin.admin_id = j_journal.editor_id', 'LEFT') + ->where('j_journal.state', 0) + ->where('journal_id', '<>', 13)//临时去掉25号新刊 + ->order(['j_journal.sort desc', 'j_journal.journal_id']) + ->select(); - foreach($res as $k => $v){ - if($v['journal_id']=='22'){ + foreach ($res as $k => $v) { + if ($v['journal_id'] == '22') { $res[$k]['title'] = "Chinese Quintessence Research 国学研究"; } } @@ -102,40 +105,42 @@ class Journal extends Controller { /** * @title 获取期刊列表byname * @description 获取期刊列表byname + * @return journalList:期刊列表@ + * @journalList title:标题 issn:issn editorinchief:editorinchief acceptance:acceptance finaldecision:finaldecision apc:apc * @author wangjinlei * @url /api/Journal/getJournalListByName * @method POST - * - * - * @return journalList:期刊列表@ - * @journalList title:标题 issn:issn editorinchief:editorinchief acceptance:acceptance finaldecision:finaldecision apc:apc + * + * */ - public function getJournalListByName() { + public function getJournalListByName() + { $where['j_journal.state'] = 0; $res = $this->journal_obj - ->field('j_journal.*,j_admin.realname realname') - ->join('j_admin', 'j_admin.admin_id = j_journal.editor_id', 'LEFT') - ->where($where) - ->order('j_journal.title') - ->select(); + ->field('j_journal.*,j_admin.realname realname') + ->join('j_admin', 'j_admin.admin_id = j_journal.editor_id', 'LEFT') + ->where($where) + ->order('j_journal.title') + ->select(); 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 relats:关联数组# * @return journalAbs:期刊外链信息array# * @return journalstage:期刊分期信息array# + * @author wangjinlei + * @url /api/Journal/getJournal + * @method POST + * */ - public function getJournal() { + public function getJournal() + { $data = $this->request->post(); $journal_info = $this->journal_obj->where('journal_id', $data['journal_id'])->find(); $rearr = $journal_info['relate'] == '' ? [] : explode(',', $journal_info['relate']); @@ -144,8 +149,8 @@ class Journal extends Controller { $stageList = $this->journal_stage_obj->where('journal_id', $data['journal_id'])->where('is_publish', 1)->where('state', 0)->order('stage_year desc,stage_no desc')->select(); //获取期刊主编辑 chengxiaoling start 20250626 - if(!empty($journal_info)){ - $aBoard = $this->getJournalBoard(['issn' => $journal_info['issn'],'type' => 0]); + if (!empty($journal_info)) { + $aBoard = $this->getJournalBoard(['issn' => $journal_info['issn'], 'type' => 0]); $aBoard = empty($aBoard['data']) ? [] : $aBoard['data']; $sBoard = empty($aBoard) ? '' : implode("
", array_unique(array_column($aBoard, 'realname'))); $sBoard = trim($sBoard); @@ -156,19 +161,20 @@ class Journal extends Controller { } - public function getJournalEthics(){ + public function getJournalEthics() + { $data = $this->request->post(); $rule = new Validate([ - "journal_id"=>"require" + "journal_id" => "require" ]); - if(!$rule->check($data)){ + if (!$rule->check($data)) { return jsonError($rule->getError()); } - $journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find(); + $journal_info = $this->journal_obj->where('journal_id', $data['journal_id'])->find(); $url = "http://api.tmrjournals.com/public/index.php/api/Web/getJournalEthics"; $program['issn'] = $journal_info['issn']; - $res = object_to_array(json_decode(myPost($url,$program))); + $res = object_to_array(json_decode(myPost($url, $program))); return jsonSuccess($res); } @@ -176,7 +182,8 @@ class Journal extends Controller { /** * 获取所有底栏文章 */ - public function getAllFooter(){ + public function getAllFooter() + { $where['footer_state'] = 0; $list = $this->footer_obj->where($where)->order('sort desc')->select(); $frag = []; @@ -211,7 +218,8 @@ class Journal extends Controller { /** * 获取底栏文章详情 */ - public function getFooterAtrNew(){ + public function getFooterAtrNew() + { $data = $this->request->post(); // 验证规则 $rule = new Validate([ @@ -220,7 +228,7 @@ class Journal extends Controller { if (!$rule->check($data)) { return jsonError($rule->getError()); } - $footer_detail = $this->footer_obj->where('footer_id',$data['footer_id'])->find(); + $footer_detail = $this->footer_obj->where('footer_id', $data['footer_id'])->find(); $re['footer'] = $footer_detail; return jsonSuccess($re); } @@ -228,7 +236,8 @@ class Journal extends Controller { /** * 获取所有forAuthors */ - public function getForAuthors(){ + public function getForAuthors() + { $data = $this->request->post(); // 验证规则 $rule = new Validate([ @@ -237,35 +246,35 @@ class Journal extends Controller { if (!$rule->check($data)) { return jsonError($rule->getError()); } - $noinjfa = $this->journal_for_author_yc_obj->where('journal_id',$data['journal_id'])->column('jfa_id'); - if($data['journal_id']!=22){ - $journals[]=0;//0代表公共的项目 + $noinjfa = $this->journal_for_author_yc_obj->where('journal_id', $data['journal_id'])->column('jfa_id'); + if ($data['journal_id'] != 22) { + $journals[] = 0;//0代表公共的项目 } - $journals[]=$data['journal_id']; + $journals[] = $data['journal_id']; // $list = $this->journal_for_author->where('journal_id','in',$journals)->where('pid',0)->where('jfa_state',0)->order("sort desc")->select(); - $list = $this->journal_for_author->where('pid',0)->where('jfa_state',0)->order("sort desc")->select(); - foreach($list as $k => $v){ - $cache_list = $this->journal_for_author->where('journal_id','in',$journals)->where('jfa_id',"not in",$noinjfa)->where('pid',$v['jfa_id'])->where('jfa_state',0)->order("sort desc")->select(); + $list = $this->journal_for_author->where('pid', 0)->where('jfa_state', 0)->order("sort desc")->select(); + foreach ($list as $k => $v) { + $cache_list = $this->journal_for_author->where('journal_id', 'in', $journals)->where('jfa_id', "not in", $noinjfa)->where('pid', $v['jfa_id'])->where('jfa_state', 0)->order("sort desc")->select(); $list[$k]['children'] = $cache_list; } $re['forAuthors'] = $list; return jsonSuccess($re); - } /** * @title 获取期刊信息通过issn * @description 获取期刊信息通过issn + * @param name:issn type:string require:1 desc:issn号 + * * @author wangjinlei * @url /api/Journal/getJournalByIssn * @method POST - * - * @param name:issn type:string require:1 desc:issn号 - * + * */ - public function getJournalByIssn() { + public function getJournalByIssn() + { $data = $this->request->post(); $journal_info = $this->journal_obj->where('issn', $data['issn'])->find(); return jsonSuccess($journal_info); @@ -274,28 +283,29 @@ class Journal extends Controller { /** * @title 获取期刊话题 * @description 获取期刊话题 + * @param name:journal_id type:int require:1 desc:期刊id + * + * @return topicList:期刊话题列表array# * @author wangjinlei * @url /api/Journal/getJournalTopic * @method POST - * - * @param name:journal_id type:int require:1 desc:期刊id - * - * @return topicList:期刊话题列表array# + * */ - public function getJournalTopic() { + public function getJournalTopic() + { $data = $this->request->post(); $p_res = $this->journal_topic_obj - ->where('journal_id', $data['journal_id']) - ->where('state', 0) - ->where('parent_id', 0) - ->order('sort') - ->select(); + ->where('journal_id', $data['journal_id']) + ->where('state', 0) + ->where('parent_id', 0) + ->order('sort') + ->select(); $res = $this->journal_topic_obj - ->where('journal_id', $data['journal_id']) - ->where('state', 0) - ->where('parent_id', '>', 0) - ->order('sort asc,journal_topic_id asc') - ->select(); + ->where('journal_id', $data['journal_id']) + ->where('state', 0) + ->where('parent_id', '>', 0) + ->order('sort asc,journal_topic_id asc') + ->select(); //处理数组 $frag = $p_res; // foreach ($res as $v) { @@ -309,7 +319,8 @@ class Journal extends Controller { return json(['code' => 0, 'msg' => 'success', 'data' => ['topicList' => $frag]]); } - private function getChieldarr($vv, $res) { + private function getChieldarr($vv, $res) + { if ($vv['is_final'] == 1) { return $vv; } @@ -324,15 +335,16 @@ class Journal extends Controller { /** * @title 获取期刊line * @description 获取期刊line + * @param name:journal_id type:int require:1 desc:期刊id + * + * @return lines:期刊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() { + 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(); @@ -343,25 +355,26 @@ class Journal extends Controller { /** * @title 获取期刊line文章 * @description 获取期刊line文章 + * @param name:journal_line_id type:int require:1 desc:期刊lineid + * + * @return journalLine:期刊时间线信息# + * @return articles:期刊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() { + public function getJournalLineArt() + { $data = $this->request->post(); $journalLine = $this->journal_line_obj->where('journal_line_id', $data['journal_line_id'])->find(); $journal_info = $this->journal_obj->where('journal_id', $journalLine['journal_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) - ->order('j_article.sort desc') - ->select(); + ->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) + ->order('j_article.sort desc') + ->select(); $re['journalLine'] = $journalLine; $re['articles'] = strongArticleList($list); return jsonSuccess($re); @@ -370,13 +383,14 @@ class Journal extends Controller { /** * @title 获取期刊五个话题 * @description 获取期刊五个话题 + * @return journals:期刊话题列表array# * @author wangjinlei * @url /api/Journal/getJournalFiveTopics * @method POST - * - * @return journals:期刊话题列表array# + * */ - public function getJournalFiveTopics() { + public function getJournalFiveTopics() + { $journals = $this->journal_obj->where('state', 0)->select(); foreach ($journals as $k => $v) { $topic_info = $this->journal_topic_obj->where('journal_id', $v['journal_id'])->where('title', 'Topics')->where('state', 0)->find(); @@ -391,22 +405,23 @@ class Journal extends Controller { /** * @title 获取所有期刊话题 * @description 获取所有期刊话题 + * @return topic:话题列表array# * @author wangjinlei * @url /api/Journal/getAllTopics * @method POST - * - * @return topic:话题列表array# + * */ - public function getAllTopics() { + public function getAllTopics() + { $parents = $this->base_topic_obj->where('parent_id', 0)->where('state', 0)->order('sort desc')->select(); - + $topicIds = $this->journal_topic_obj->where('title', 'Topics')->where('state', 0)->column('journal_topic_id'); $ca = $this->journal_topic_obj->where('parent_id', 'in', $topicIds)->where('state', 0)->select(); foreach ($parents as $k => $v) { $cache = $this->base_topic_obj->where('parent_id', $v['base_topic_id']) - ->where('state', 0) - ->order('sort desc') - ->select(); + ->where('state', 0) + ->order('sort desc') + ->select(); $cache1 = []; foreach ($cache as $val) { if ($this->myCheckTopic($val['title'], $ca)) { @@ -419,7 +434,8 @@ class Journal extends Controller { return jsonSuccess($re); } - private function myCheckTopic($value, $array) { + private function myCheckTopic($value, $array) + { $frag = false; foreach ($array as $v) { if ($v['title'] == $value) { @@ -430,7 +446,8 @@ class Journal extends Controller { return $frag; } - private function check_topic($value, $frag) { + private function check_topic($value, $frag) + { $fra = false; foreach ($frag as $k => $v) { if ($value['title'] == $v['title']) { @@ -443,25 +460,26 @@ class Journal extends Controller { /** * @title 查找话题期刊 * @description 查找话题期刊 + * @param name:topic type:string require:1 desc:话题 + * + * @return journals:期刊list# * @author wangjinlei * @url /api/Journal/findJournalTopic1 * @method POST - * - * @param name:topic type:string require:1 desc:话题 - * - * @return journals:期刊list# + * */ - public function findJournalTopic1() { + public function findJournalTopic1() + { $data = $this->request->post(); $base_topic = $this->base_topic_obj->where('base_topic_id', $data['topic'])->find(); $topicids = $this->journal_topic_obj->where('title', 'Topics')->where('state', 0)->column('journal_topic_id'); $list = $this->journal_topic_obj - ->field('j_journal.*,j_journal_topic.title topic_title,j_journal_topic.journal_topic_id') - ->join('j_journal', 'j_journal.journal_id = j_journal_topic.journal_id', 'left') - ->where('j_journal_topic.parent_id', 'in', $topicids) - ->where('j_journal_topic.state', 0) - ->where('j_journal_topic.title', 'like', '%' . $base_topic['title'] . '%') - ->select(); + ->field('j_journal.*,j_journal_topic.title topic_title,j_journal_topic.journal_topic_id') + ->join('j_journal', 'j_journal.journal_id = j_journal_topic.journal_id', 'left') + ->where('j_journal_topic.parent_id', 'in', $topicids) + ->where('j_journal_topic.state', 0) + ->where('j_journal_topic.title', 'like', '%' . $base_topic['title'] . '%') + ->select(); foreach ($list as $k => $v) { $abs = $this->journal_abs_obj->where('journal_id', $v['journal_id'])->where('state', 0)->order('sort')->limit(4)->select(); @@ -475,19 +493,20 @@ class Journal extends Controller { /** * @title 查找话题期刊 * @description 查找话题期刊 + * @param name:journal_topic_id type:int require:1 desc:话题id + * + * @return journals:期刊list# * @author wangjinlei * @url /api/Journal/findJournalTopic * @method POST - * - * @param name:journal_topic_id type:int require:1 desc:话题id - * - * @return journals:期刊list# + * */ - public function findJournalTopic() { + public function findJournalTopic() + { $data = $this->request->post(); $list = []; if ($data['journal_topic_id'] == 0) { - $journals = $this->journal_obj->where('state', 0)->where("journal_id","<>",13)->order("sort desc")->select(); + $journals = $this->journal_obj->where('state', 0)->where("journal_id", "<>", 13)->order("sort desc")->select(); foreach ($journals as $k => $v) { $topic_info = $this->journal_topic_obj->where('journal_id', $v['journal_id'])->where('title', 'Topics')->where('state', 0)->find(); $cache = $this->journal_topic_obj->where('parent_id', $topic_info['journal_topic_id'])->where('state', 0)->limit(5)->select(); @@ -498,15 +517,15 @@ class Journal extends Controller { $topic_info = $this->journal_topic_obj->where('journal_topic_id', $data['journal_topic_id'])->find(); $tpids = $this->journal_topic_obj->where('title', 'Topics')->where('state', 0)->column('journal_topic_id'); $journals = $this->journal_topic_obj - ->field('j_journal.*,j_journal_topic.title topic_title,j_journal_topic.journal_topic_id') - ->join('j_journal', 'j_journal.journal_id = j_journal_topic.journal_id', 'left') - ->where('j_journal_topic.parent_id', 'in', $tpids) - ->where('j_journal_topic.title', $topic_info['title']) - ->where('j_journal_topic.state', 0) - ->where("j_journal.journal_id","<>",13) - // ->where("j_journal.journal_id","<>",25) - ->order("j_journal.sort desc") - ->select(); + ->field('j_journal.*,j_journal_topic.title topic_title,j_journal_topic.journal_topic_id') + ->join('j_journal', 'j_journal.journal_id = j_journal_topic.journal_id', 'left') + ->where('j_journal_topic.parent_id', 'in', $tpids) + ->where('j_journal_topic.title', $topic_info['title']) + ->where('j_journal_topic.state', 0) + ->where("j_journal.journal_id", "<>", 13) + // ->where("j_journal.journal_id","<>",25) + ->order("j_journal.sort desc") + ->select(); $list = $journals; } foreach ($list as $k => $v) { @@ -520,18 +539,19 @@ class Journal extends Controller { /** * @title 获取通用话题文章 * @description 获取通用话题文章 - * @author wangjinlei - * @url /api/Journal/getBaseTopicArticles - * @method POST - * * @param name:base_topic_id type:int require:1 desc:通用话题id * @param name:pageIndex type:int require:1 desc:当前页码数 * @param name:pageSize type:int require:1 desc:单页数据条数 - * + * * @return articleList:文章信息# * @return count:总数 + * @author wangjinlei + * @url /api/Journal/getBaseTopicArticles + * @method POST + * */ - public function getBaseTopicArticles() { + public function getBaseTopicArticles() + { $data = $this->request->post(); $limit_start = ($data['pageIndex'] - 1) * $data['pageSize']; $base_topic_info = $this->base_topic_obj->where('base_topic_id', $data['base_topic_id'])->find(); @@ -543,18 +563,18 @@ class Journal extends Controller { } $ids = $this->article_to_topic_obj->where('topic_id', 'in', $topicids)->where('state', 0)->column('article_id'); $list = $this->article_obj - ->field('j_article.*,j_journal_stage.*,j_journal.jabbr,j_journal.usx,j_journal.title journal_title') - ->join('j_journal', 'j_article.journal_id = j_journal.journal_id', 'left') - ->join('j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'left') - ->where('j_article.article_id', 'in', $ids) - ->where('j_article.state', 0) - ->order('j_journal_stage.stage_year desc,j_article.article_id desc') - ->limit($limit_start, $data['pageSize']) - ->select(); + ->field('j_article.*,j_journal_stage.*,j_journal.jabbr,j_journal.usx,j_journal.title journal_title') + ->join('j_journal', 'j_article.journal_id = j_journal.journal_id', 'left') + ->join('j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'left') + ->where('j_article.article_id', 'in', $ids) + ->where('j_article.state', 0) + ->order('j_journal_stage.stage_year desc,j_article.article_id desc') + ->limit($limit_start, $data['pageSize']) + ->select(); $count = $this->article_obj - ->where('j_article.article_id', 'in', $ids) - ->where('j_article.state', 0) - ->count(); + ->where('j_article.article_id', 'in', $ids) + ->where('j_article.state', 0) + ->count(); $re['topic'] = $base_topic_info; $re['articleList'] = strongArticleList($list);; $re['count'] = $count; @@ -562,34 +582,34 @@ class Journal extends Controller { } - /** * @title 获取期刊推广文章 * @description 获取期刊推广文章 + * @param name:journal_id type:int require:1 desc:期刊id + * + * @return articleList:期刊话题列表array# + * @return stage:当前分期信息array# * @author wangjinlei * @url /api/Journal/getJournalArticles * @method POST - * - * @param name:journal_id type:int require:1 desc:期刊id - * - * @return articleList:期刊话题列表array# - * @return stage:当前分期信息array# + * */ - public function getJournalArticles() { + public function getJournalArticles() + { $data = $this->request->post(); $journal_info = $this->journal_obj->where('journal_id', $data['journal_id'])->find(); $order = "sort asc"; - if(($journal_info['journal_id']==2&&$journal_info['publish_stage_id']>=337)||($journal_info['journal_id']==17&&$journal_info['publish_stage_id']>=346)||($journal_info['journal_id']==18&&$journal_info['publish_stage_id']>=338)){ + if (($journal_info['journal_id'] == 2 && $journal_info['publish_stage_id'] >= 337) || ($journal_info['journal_id'] == 17 && $journal_info['publish_stage_id'] >= 346) || ($journal_info['journal_id'] == 18 && $journal_info['publish_stage_id'] >= 338)) { $order = "sort desc"; } $list = $this->article_obj->where('journal_stage_id', $journal_info['publish_stage_id']) - ->where('state', 0) - ->where("lx_online",1) - ->order($order) - ->select(); + ->where('state', 0) + ->where("lx_online", 1) + ->order($order) + ->select(); $stage_info = $this->journal_stage_obj->where('journal_stage_id', $journal_info['publish_stage_id'])->find(); - $list = strongArticleList($list,false); + $list = strongArticleList($list, false); // foreach ($list as $k => $v){ // $cache_topic = $this->article_to_topic_obj->field('j_journal_topic.*')->join('j_journal_topic', 'j_journal_topic.journal_topic_id = j_article_to_topic.topic_id', 'left')->where('j_article_to_topic.article_id', $v['article_id'])->where('j_article_to_topic.state', 0)->select(); // $list[$k]['topic'] = $cache_topic; @@ -598,26 +618,28 @@ class Journal extends Controller { return json(['code' => 0, 'msg' => 'success', 'data' => ['stage' => $stage_info, 'articleList' => $list]]); } - public function getJournalOnlineForLx(){ + public function getJournalOnlineForLx() + { $data = $this->request->post(); $rule = new Validate([ - "journal_id"=>"require" + "journal_id" => "require" ]); - if(!$rule->check($data)){ + if (!$rule->check($data)) { return jsonError($rule->getError()); } - $journal_info = $this->journal_obj->where("journal_id",$data['journal_id'])->find(); - if($journal_info['cycle']!=0){ + $journal_info = $this->journal_obj->where("journal_id", $data['journal_id'])->find(); + if ($journal_info['cycle'] != 0) { return jsonError("error"); } - $stage_info = $this->journal_stage_obj->where("stage_year",date("Y"))->where("state",0)->find(); - $list = $this->article_obj->where("journal_stage_id",$stage_info['journal_stage_id'])->where("lx_online",0)->where("state",0)->select(); + $stage_info = $this->journal_stage_obj->where("stage_year", date("Y"))->where("state", 0)->find(); + $list = $this->article_obj->where("journal_stage_id", $stage_info['journal_stage_id'])->where("lx_online", 0)->where("state", 0)->select(); $re['list'] = $list; return jsonSuccess($re); } - private function getAuthor($article) { + private function getAuthor($article) + { $where['article_id'] = $article['article_id']; $where['state'] = 0; $list = $this->article_author_obj->where($where)->select(); @@ -635,13 +657,14 @@ class Journal extends Controller { /** * @title 获取文章作者分布 * @description 获取文章作者分布 + * @param name:journal_id type:int require:1 desc:期刊id * @author wangjinlei * @url /api/Journal/getAuthorFB * @method POST - * - * @param name:journal_id type:int require:1 desc:期刊id + * */ - public function getAuthorFB() { + public function getAuthorFB() + { $data = $this->request->post(); $stages = $this->journal_stage_obj->where('journal_id', $data['journal_id'])->where('stage_year', '>', (intval(date('Y')) - 3))->where('state', 0)->column('journal_stage_id'); $articles = $this->article_obj->where('journal_id', $data['journal_id'])->where('journal_stage_id', 'in', $stages)->where('state', 0)->column('article_id'); @@ -688,131 +711,129 @@ class Journal extends Controller { /** * @title 获取onlinefirst文章 * @description 获取onlinefirst文章 - * @author wangjinlei - * @url /api/Journal/getOnlineArticle - * @method POST - * * @param name:journal_id type:int require:1 desc:期刊id * @param name:pageIndex type:int require:1 desc:当前页码数 * @param name:pageSize type:int require:1 desc:单页数据条数 - * + * * @return articlelist:文章列表array# * @return count:总数 + * @author wangjinlei + * @url /api/Journal/getOnlineArticle + * @method POST + * */ - public function getOnlineArticle() { + public function getOnlineArticle() + { $data = $this->request->post(); $journal_info = $this->journal_obj->where('journal_id', $data['journal_id'])->find(); $limit_start = ($data['pageIndex'] - 1) * $data['pageSize']; - if($journal_info['cycle']==0){//连续出刊的标志是0 - $stage = $this->journal_stage_obj->where("journal_id",$data['journal_id'])->where("stage_year",date("Y"))->where("state",0)->find(); - $query = $this->article_obj - ->field("j_article.article_id,j_article.journal_id,j_article.npp,j_article.doi,j_article.journal_stage_id,j_article.title,j_article.icon,j_article.abbr,j_journal_stage.stage_year") - ->join('j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT') - ->where("j_article.journal_id",$journal_info["journal_id"]) - ->where("j_article.lx_online",0) - ->where("j_journal_stage.journal_stage_id",$stage['journal_stage_id']); - $list = $query->limit($limit_start,$data['pageSize'])->select(); - $count = $query->count(); -// $list = $this->article_obj + if ($journal_info['cycle'] == 0) {//连续出刊的标志是0 + $stage = $this->journal_stage_obj->where("journal_id", $data['journal_id'])->where("stage_year", date("Y"))->where("state", 0)->find(); + + $list = $this->article_obj //// ->field('j_article.*,j_journal_stage.*') -// ->field("j_article.article_id,j_article.title,j_article.icon,j_article.abbr,j_journal_stage.stage_year") -// ->join('j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT') -// ->where("j_article.journal_id",$journal_info["journal_id"]) -// ->where("j_article.lx_online",0) -// ->where("j_journal_stage.journal_stage_id",$stage['journal_stage_id']) -// ->limit($limit_start,$data['pageSize']) -// ->select(); -// $count = $this->article_obj -// ->join('j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT') -// ->where("j_article.journal_id",$journal_info["journal_id"]) -// ->where("j_article.lx_online",0) -// ->where("j_journal_stage.journal_stage_id",$stage['journal_stage_id']) -// ->count(); - return json(['code' => 0, 'msg' => 'success', 'data' => ['articlelist' => $list, 'count' => $count]]); - }else{ +// ->field("j_article.article_id,j_article.journal_id,j_article.npp,j_article.type,j_article.abstract,j_article.abs_num,j_article.html_num,j_article.doi,j_article.journal_stage_id,j_article.title,j_article.icon,j_article.abbr,j_journal_stage.stage_year") + ->field("j_article.*,j_journal_stage.*") + ->join('j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT') + ->where("j_article.journal_id", $journal_info["journal_id"]) + ->where("j_article.lx_online", 0) + ->where("j_journal_stage.journal_stage_id", $stage['journal_stage_id']) + ->limit($limit_start, $data['pageSize']) + ->select(); + $count = $this->article_obj + ->join('j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT') + ->where("j_article.journal_id", $journal_info["journal_id"]) + ->where("j_article.lx_online", 0) + ->where("j_journal_stage.journal_stage_id", $stage['journal_stage_id']) + ->count(); + return json(['code' => 0, 'msg' => 'success', 'data' => ['articlelist' => strongArticleList($list, false), 'count' => $count]]); + } else { $stages = $this->journal_stage_obj->where('journal_id', $data['journal_id'])->where('is_publish', 0)->where('state', 0)->column('journal_stage_id'); - $query = $this->article_obj - ->field("j_article.article_id,j_article.journal_id,j_article.npp,j_article.doi,j_article.journal_stage_id,j_article.title,j_article.icon,j_article.abbr,j_journal_stage.stage_year") + // $list = $this->article_obj + // ->field("j_article.article_id,j_article.journal_id,j_article.npp,j_article.type,j_article.abstract,j_article.abs_num,j_article.html_num,j_article.doi,j_article.journal_stage_id,j_article.title,j_article.icon,j_article.abbr,j_journal_stage.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.is_public',1) + // ->order('j_journal_stage.stage_year desc,j_article.sort desc') +// ->limit($limit_start, $data['pageSize'])->select(); + // $count = $this->article_obj + // ->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.is_public',1) +// ->count(); + $list = $this->article_obj + ->field('j_article.*,j_journal_stage.*') +// ->field("j_article.article_id,j_article.journal_id,j_article.npp,j_article.type,j_article.abstract,j_article.abs_num,j_article.html_num,j_article.doi,j_article.journal_stage_id,j_article.title,j_article.icon,j_article.abbr,j_journal_stage.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.is_public',1) - ->order('j_journal_stage.stage_year desc,j_article.sort desc'); - $list = $query->limit($limit_start, $data['pageSize'])->select(); - $count = $query->count(); - -// $list = $this->article_obj -//// ->field('j_article.*,j_journal_stage.*') -// ->field("j_article.article_id,j_article.title,j_article.icon,j_article.abbr,j_journal_stage.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.is_public',1) -// ->order('j_journal_stage.stage_year desc,j_article.sort desc') -// ->limit($limit_start, $data['pageSize']) -// ->select(); -// $count = $this->article_obj -// ->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) -// ->count(); - return json(['code' => 0, 'msg' => 'success', 'data' => ['articlelist' => $list, 'count' => $count]]); + ->where('j_article.is_public', 1) + ->order('j_journal_stage.stage_year desc,j_article.sort desc') + ->limit($limit_start, $data['pageSize']) + ->select(); + $count = $this->article_obj + ->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) + ->count(); + return json(['code' => 0, 'msg' => 'success', 'data' => ['articlelist' => strongArticleList($list, false), 'count' => $count]]); } } - - - /** * @title 获取news文章 * @description 获取news文章 + * @param name:journal_id type:int require:1 desc:期刊id + * + * @return articlelist:文章列表array# * @author wangjinlei * @url /api/Journal/getNewsArticle * @method POST - * - * @param name:journal_id type:int require:1 desc:期刊id - * - * @return articlelist:文章列表array# + * */ - public function getNewsArticle() { + public function getNewsArticle() + { $data = $this->request->post(); $stages = $this->journal_stage_obj->where('journal_id', $data['journal_id'])->where('state', 0)->column('journal_stage_id'); $journal_info = $this->journal_obj->where('journal_id', $data['journal_id'])->find(); $list = $this->article_obj - ->field('j_article.*,j_journal_stage.*') - ->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_journal_stage.stage_year', '>', '2018') - ->where('j_article.type', ['eq', 'News'], ['eq', 'Comment'], 'or') - ->order('j_journal_stage.stage_year desc,j_journal_stage.stage_vol desc,j_journal_stage.stage_no desc,j_article.article_id desc') - ->limit(4) - ->select(); - return json(['code' => 0, 'msg' => 'success', 'data' => ['articlelist' => strongArticleList($list,false)]]); + ->field('j_article.*,j_journal_stage.*') + ->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_journal_stage.stage_year', '>', '2018') + ->where('j_article.type', ['eq', 'News'], ['eq', 'Comment'], 'or') + ->order('j_journal_stage.stage_year desc,j_journal_stage.stage_vol desc,j_journal_stage.stage_no desc,j_article.article_id desc') + ->limit(4) + ->select(); + return json(['code' => 0, 'msg' => 'success', 'data' => ['articlelist' => strongArticleList($list, false)]]); } /** * @title 获取news文章 * @description 获取news文章 + * @param name:journal_id type:int require:1 desc:期刊id + * + * @return articlelist:文章列表array# * @author wangjinlei * @url /api/Journal/getNewsArticle * @method POST * - * @param name:journal_id type:int require:1 desc:期刊id - * - * @return articlelist:文章列表array# */ - public function getNewsArticleNew() { + public function getNewsArticleNew() + { $data = $this->request->post(); $rule = new Validate([ "journal_id" => "require", - "limit" =>"require", + "limit" => "require", "page" => "require" ]); - if(!$rule->check($data)){ + if (!$rule->check($data)) { return jsonError($rule->getError()); } @@ -826,9 +847,9 @@ class Journal extends Controller { ->where('j_journal_stage.stage_year', '>', '2018') ->where('j_article.type', ['eq', 'News'], ['eq', 'Comment'], 'or') ->order('j_journal_stage.stage_year desc,j_journal_stage.stage_vol desc,j_journal_stage.stage_no desc,j_article.article_id desc') - ->page($data['page'],$data['limit']) + ->page($data['page'], $data['limit']) ->select(); - $count= $this->article_obj + $count = $this->article_obj ->field('j_article.*,j_journal_stage.*') ->join('j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT') ->where('j_article.journal_stage_id', 'in', $stages) @@ -877,38 +898,65 @@ class Journal extends Controller { } - - /** * @title 获取top前4条article * @description 获取top前4条article - * @author wangjinlei - * @url /api/Journal/getTopArticle - * @method POST - * * @param name:journal_id type:int require:1 desc:期刊id * @param name:pageIndex type:int require:1 desc:当前页码数 * @param name:pageSize type:int require:1 desc:单页数据条数 - * + * * @return articles:文章列表array# * @return count:总数 + * @author wangjinlei + * @url /api/Journal/getTopArticle + * @method POST + * */ - public function getTopArticle() { + public function getTopArticle() + { $data = $this->request->post(); $rule = new Validate([ - "journal_id"=>"require", - "pageIndex"=>"require", - "pageSize"=>"require" + "journal_id" => "require", + "pageIndex" => "require", + "pageSize" => "require" ]); - if(!$rule->check($data)){ + if (!$rule->check($data)) { return jsonError($rule->getError()); } $limit_start = ($data['pageIndex'] - 1) * $data['pageSize']; - if($data['journal_id']==1){ + if ($data['journal_id'] == 1) { - $query = $this->article_obj - ->field("j_article.article_id,j_article.journal_id,j_article.npp,j_article.doi,j_article.journal_stage_id,j_article.title,j_article.icon,j_article.abbr,count(j_article_cite.article_id) as cited_num") +// $list = $this->article_obj +// ->field("j_article.article_id,j_article.journal_id,j_article.npp,j_article.type,j_article.abstract,j_article.abs_num,j_article.html_num,j_article.doi,j_article.journal_stage_id,j_article.title,j_article.icon,j_article.abbr,count(j_article_cite.article_id) as cited_num") +// ->join("j_journal_stage", 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT') +// ->join("j_article_cite", "j_article_cite.article_id = j_article.article_id", "left") +// ->where('j_article.journal_id', $data['journal_id']) +// ->where('j_article.state', 0) +// ->where("j_journal_stage.stage_year", ">", date("Y") - 6) +// ->where("j_article_cite.is_wos", 1) +// ->where('j_journal_stage.is_publish', 1) +// ->group("j_article.article_id") +// ->having("count(j_article_cite.article_cite_id) > 3") +// ->order("cited_num desc") +// ->limit($limit_start, $data['pageSize'])->select(); +// +// $count = $this->article_obj +// ->field("j_article.article_id,j_article.journal_id,j_article.npp,j_article.type,j_article.abstract,j_article.abs_num,j_article.html_num,j_article.doi,j_article.journal_stage_id,j_article.title,j_article.icon,j_article.abbr,count(j_article_cite.article_id) as cited_num") +// ->join("j_journal_stage", 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT') +// ->join("j_article_cite", "j_article_cite.article_id = j_article.article_id", "left") +// ->where('j_article.journal_id', $data['journal_id']) +// ->where('j_article.state', 0) +// ->where("j_journal_stage.stage_year", ">", date("Y") - 6) +// ->where("j_article_cite.is_wos", 1) +// ->where('j_journal_stage.is_publish', 1) +// ->group("j_article.article_id") +// ->having("count(j_article_cite.article_cite_id) > 3") +// ->order("cited_num desc") +// ->count(); + + $list = $this->article_obj + ->field("j_article.*,count(j_article_cite.article_id) as cited_num") ->join("j_journal_stage",'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT') ->join("j_article_cite","j_article_cite.article_id = j_article.article_id","left") ->where('j_article.journal_id', $data['journal_id']) @@ -918,72 +966,54 @@ class Journal extends Controller { ->where('j_journal_stage.is_publish', 1) ->group("j_article.article_id") ->having("count(j_article_cite.article_cite_id) > 3") - ->order("cited_num desc"); - $list = $query->limit($limit_start,$data['pageSize'])->select(); - $count = $query->count(); - -// $list = $this->article_obj -// ->field("j_article.*,count(j_article_cite.article_id) as cited_num") -// ->join("j_journal_stage",'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT') -// ->join("j_article_cite","j_article_cite.article_id = j_article.article_id","left") + ->order("cited_num desc") + ->limit($limit_start,$data['pageSize']) + ->select(); + $count = $this->article_obj + ->join("j_journal_stage",'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT') + ->join("j_article_cite","j_article_cite.article_id = j_article.article_id","left") + ->where('j_article.journal_id', $data['journal_id']) + ->where('j_article.state', 0) + ->where("j_journal_stage.stage_year",">",date("Y")-6) + ->where("j_article_cite.is_wos",1) + ->where('j_journal_stage.is_publish', 1) + ->group("j_article.article_id") + ->having("count(j_article_cite.article_cite_id) > 3") + ->count(); + } else { +// $query = $this->article_obj +// ->field("j_article.article_id,j_article.journal_id,j_article.npp,j_article.doi,j_article.type,j_article.abstract,j_article.abs_num,j_article.html_num,j_article.journal_stage_id,j_article.title,j_article.icon,j_article.abbr") +// ->join("j_journal_stage", "j_journal_stage.journal_stage_id = j_article.journal_stage_id", "left") // ->where('j_article.journal_id', $data['journal_id']) // ->where('j_article.state', 0) -// ->where("j_journal_stage.stage_year",">",date("Y")-6) -// ->where("j_article_cite.is_wos",1) +// ->where("j_journal_stage.stage_year", ">", date("Y") - 6) // ->where('j_journal_stage.is_publish', 1) -// ->group("j_article.article_id") -// ->having("count(j_article_cite.article_cite_id) > 3") -// ->order("cited_num desc") -// ->limit($limit_start,$data['pageSize']) -// ->select(); -// $count = $this->article_obj -// ->join("j_journal_stage",'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT') -// ->join("j_article_cite","j_article_cite.article_id = j_article.article_id","left") -// ->where('j_article.journal_id', $data['journal_id']) -// ->where('j_article.state', 0) -// ->where("j_journal_stage.stage_year",">",date("Y")-6) -// ->where("j_article_cite.is_wos",1) -// ->where('j_journal_stage.is_publish', 1) -// ->group("j_article.article_id") -// ->having("count(j_article_cite.article_cite_id) > 3") -// ->count(); - }else{ - $query = $this->article_obj - ->field("j_article.article_id,j_article.journal_id,j_article.npp,j_article.doi,j_article.journal_stage_id,j_article.title,j_article.icon,j_article.abbr") +// ->orderRaw("(j_article.abs_num + j_article.pdf_num + j_article.html_num) desc"); +// $list = $query->limit($limit_start, $data['pageSize'])->select(); +// $count = $query->count(); + + + $list = $this->article_obj ->join("j_journal_stage","j_journal_stage.journal_stage_id = j_article.journal_stage_id","left") ->where('j_article.journal_id', $data['journal_id']) ->where('j_article.state', 0) ->where("j_journal_stage.stage_year",">",date("Y")-6) ->where('j_journal_stage.is_publish', 1) - ->orderRaw("(j_article.abs_num + j_article.pdf_num + j_article.html_num) desc"); - $list = $query->limit($limit_start,$data['pageSize'])->select(); - $count = $query->count(); - - - - - -// $list = $this->article_obj -// ->join("j_journal_stage","j_journal_stage.journal_stage_id = j_article.journal_stage_id","left") -// ->where('j_article.journal_id', $data['journal_id']) -// ->where('j_article.state', 0) -// ->where("j_journal_stage.stage_year",">",date("Y")-6) -// ->where('j_journal_stage.is_publish', 1) -// ->orderRaw("(j_article.abs_num + j_article.pdf_num + j_article.html_num) desc") -// ->limit($limit_start,$data['pageSize']) -// ->select(); -// $count = $this->article_obj -// ->join("j_journal_stage","j_journal_stage.journal_stage_id = j_article.journal_stage_id","left") -// ->where('j_article.journal_id', $data['journal_id']) -// ->where('j_article.state', 0) -// ->where("j_journal_stage.stage_year",">",date("Y")-6) -// ->where('j_journal_stage.is_publish', 1) -// ->count(); - if($count>30){ + ->orderRaw("(j_article.abs_num + j_article.pdf_num + j_article.html_num) desc") + ->limit($limit_start,$data['pageSize']) + ->select(); + $count = $this->article_obj + ->join("j_journal_stage","j_journal_stage.journal_stage_id = j_article.journal_stage_id","left") + ->where('j_article.journal_id', $data['journal_id']) + ->where('j_article.state', 0) + ->where("j_journal_stage.stage_year",">",date("Y")-6) + ->where('j_journal_stage.is_publish', 1) + ->count(); + if ($count > 30) { $count = 30; } } - $re['articles'] = strongArticleList($list,false); + $re['articles'] = strongArticleList($list, false); $re['count'] = $count; return jsonSuccess($re); } @@ -991,15 +1021,16 @@ class Journal extends Controller { /** * @title 获取消息列表 * @description 获取消息列表 + * @param name:journal_id type:int require:1 desc:期刊id + * + * @return notices:消息列表array# * @author wangjinlei * @url /api/Journal/getNotices * @method POST - * - * @param name:journal_id type:int require:1 desc:期刊id - * - * @return notices:消息列表array# + * */ - public function getNotices() { + public function getNotices() + { $data = $this->request->post(); $list = $this->journal_notices_obj->where('journal_id', $data['journal_id'])->where('state', 0)->order('ctime desc')->select(); return jsonSuccess(['notices' => $list]); @@ -1008,15 +1039,16 @@ class Journal extends Controller { /** * @title 获取消息详情 * @description 获取消息详情 + * @param name:journal_notices_id type:int require:1 desc:期刊消息id + * + * @return notices:消息内容# * @author wangjinlei * @url /api/Journal/getNoticesDetail * @method POST - * - * @param name:journal_notices_id type:int require:1 desc:期刊消息id - * - * @return notices:消息内容# + * */ - public function getNoticesDetail() { + public function getNoticesDetail() + { $data = $this->request->post(); $notices_info = $this->journal_notices_obj->where('journal_notices_id', $data['journal_notices_id'])->find(); @@ -1027,27 +1059,28 @@ class Journal extends Controller { /** * @title 获取highl话题文章 * @description 获取highl话题文章 + * @param name:journal_id type:int require:1 desc:期刊id + * + * @return topic_info:话题详情 + * @return articlelist:文章列表array# * @author wangjinlei * @url /api/Journal/getHighTopicArticle * @method POST - * - * @param name:journal_id type:int require:1 desc:期刊id - * - * @return topic_info:话题详情 - * @return articlelist:文章列表array# + * */ - public function getHighTopicArticle() { + public function getHighTopicArticle() + { $data = $this->request->post(); $topic_info = $this->journal_topic_obj->where('journal_id', $data['journal_id'])->where('position', 'highlights')->where('state', 0)->find(); $journal_info = $this->journal_obj->where('journal_id', $data['journal_id'])->find(); if ($topic_info) { $list = $this->article_to_topic_obj->field('j_article.*,j_journal_stage.*') - ->join(array(['j_article', 'j_article.article_id = j_article_to_topic.article_id', 'LEFT'], ['j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT'])) - ->where('j_article_to_topic.topic_id', $topic_info['journal_topic_id']) - ->where('j_article_to_topic.state', 0) - ->where('j_journal_stage.is_publish', 1) - ->order('j_article.sort desc') - ->select(); + ->join(array(['j_article', 'j_article.article_id = j_article_to_topic.article_id', 'LEFT'], ['j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT'])) + ->where('j_article_to_topic.topic_id', $topic_info['journal_topic_id']) + ->where('j_article_to_topic.state', 0) + ->where('j_journal_stage.is_publish', 1) + ->order('j_article.sort desc') + ->select(); //获取作者 foreach ($list as $k => $v) { @@ -1089,16 +1122,17 @@ class Journal extends Controller { /** * @title 获取话题列表 * @description 获取话题列表 + * @param name:journal_topic_id type:int require:1 desc:期刊话题id + * + * @return oldJournal:父话题信息 + * @return journalList:话题列表array# * @author wangjinlei * @url /api/Journal/getTopicList * @method POST - * - * @param name:journal_topic_id type:int require:1 desc:期刊话题id - * - * @return oldJournal:父话题信息 - * @return journalList:话题列表array# + * */ - public function getTopicList() { + public function getTopicList() + { $data = $this->request->post(); $parent_info = $this->journal_topic_obj->where('journal_topic_id', $data['journal_topic_id'])->find(); $list = $this->journal_topic_obj->where('parent_id', $data['journal_topic_id'])->where('state', 0)->order('sort asc')->select(); @@ -1111,15 +1145,16 @@ class Journal extends Controller { /** * @title 获取期刊cfp * @description 获取期刊cfp + * @param name:journal_id type:int require:1 desc:期刊id + * + * @return cfps:期刊cfps# * @author wangjinlei * @url /api/Journal/getJournalCfp * @method POST - * - * @param name:journal_id type:int require:1 desc:期刊id - * - * @return cfps:期刊cfps# + * */ - public function getJournalCfp() { + public function getJournalCfp() + { $data = $this->request->post(); $list = $this->journal_cfp_obj->where('journal_id', $data['journal_id'])->where('state', 0)->order('sort desc ,journal_cfp_id asc')->select(); @@ -1130,15 +1165,16 @@ class Journal extends Controller { /** * @title 获取期刊cfp详情 * @description 获取期刊cfp详情 + * @param name:journal_cfp_id type:int require:1 desc:期刊cfpid + * + * @return cfp:期刊cfp信息# * @author wangjinlei * @url /api/Journal/getCfpDetail * @method POST - * - * @param name:journal_cfp_id type:int require:1 desc:期刊cfpid - * - * @return cfp:期刊cfp信息# + * */ - public function getCfpDetail() { + public function getCfpDetail() + { $data = $this->request->post(); $cfp_info = $this->journal_cfp_obj->where('journal_cfp_id', $data['journal_cfp_id'])->find(); @@ -1149,15 +1185,16 @@ class Journal extends Controller { /** * @title 获取期刊footer * @description 获取期刊footer + * @param name:journal_id type:int require:1 desc:期刊id + * + * @return footers:footers# * @author wangjinlei * @url /api/Journal/getFooter * @method POST - * - * @param name:journal_id type:int require:1 desc:期刊id - * - * @return footers:footers# + * */ - public function getFooter() { + public function getFooter() + { $data = $this->request->post(); $papers = $this->journal_paper_obj->where('journal_id', $data['journal_id'])->where('state', 0)->select(); foreach ($papers as $k => $v) { @@ -1172,15 +1209,16 @@ class Journal extends Controller { /** * @title 获取期刊footer文章 * @description 获取期刊footer文章 + * @param name:journal_paper_art_id type:int require:1 desc:期刊footer文章id + * + * @return article:文章内容# * @author wangjinlei * @url /api/Journal/getFooterArt * @method POST - * - * @param name:journal_paper_art_id type:int require:1 desc:期刊footer文章id - * - * @return article:文章内容# + * */ - public function getFooterArt() { + public function getFooterArt() + { $data = $this->request->post(); $article = $this->journal_paper_art_obj->where('journal_paper_art_id', $data['journal_paper_art_id'])->find(); @@ -1191,23 +1229,24 @@ class Journal extends Controller { /** * @title 获取期刊编委信息 * @description 获取期刊编委信息 + * @param name:journal_id type:int require:1 desc:期刊id + * + * @return boards:编委array# * @author wangjinlei * @url /api/Journal/getBoard * @method POST - * - * @param name:journal_id type:int require:1 desc:期刊id - * - * @return boards:编委array# + * */ - public function getBoard() { + public function getBoard() + { $data = $this->request->post(); $list = $this->board_obj - ->field('j_board.*,j_board_group.group_name') - ->join('j_board_group', 'j_board.board_group_id = j_board_group.board_group_id', 'left') - ->where('j_board.journal_id', $data['journal_id']) - ->where('j_board.state', 0) - ->order('j_board_group.sort desc,j_board_group.board_group_id,j_board.name') - ->select(); + ->field('j_board.*,j_board_group.group_name') + ->join('j_board_group', 'j_board.board_group_id = j_board_group.board_group_id', 'left') + ->where('j_board.journal_id', $data['journal_id']) + ->where('j_board.state', 0) + ->order('j_board_group.sort desc,j_board_group.board_group_id,j_board.name') + ->select(); $frag = []; foreach ($list as $k => $v) { if ($v['type'] == 0) { @@ -1226,33 +1265,35 @@ class Journal extends Controller { return jsonSuccess($re); } - public function getBoard1(){ + public function getBoard1() + { $data = $this->request->post(); $rule = new Validate([ - "journal_id"=>"require" + "journal_id" => "require" ]); - if(!$rule->check($data)){ + if (!$rule->check($data)) { return jsonError($rule->getError()); } - $journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find(); + $journal_info = $this->journal_obj->where('journal_id', $data['journal_id'])->find(); $url = "http://api.tmrjournals.com/public/index.php/api/Web/getBoardsByIssn"; $program['issn'] = $journal_info['issn']; - $res = object_to_array(json_decode(myPost($url,$program))); + $res = object_to_array(json_decode(myPost($url, $program))); return jsonSuccess($res); } /** * @title 获取期刊话题列表 * @description 获取期刊话题列表 + * @param name:journal_id type:int require:1 desc:期刊id + * + * @return topics:话题列表array# * @author wangjinlei * @url /api/Journal/getTopicForSubscribe * @method POST - * - * @param name:journal_id type:int require:1 desc:期刊id - * - * @return topics:话题列表array# + * */ - public function getTopicForSubscribe() { + public function getTopicForSubscribe() + { $data = $this->request->post(); $list = $this->journal_topic_obj->where('journal_id', $data['journal_id'])->where('state', 0)->where('level', 2)->select(); @@ -1264,21 +1305,22 @@ class Journal extends Controller { /** * @title 添加期刊订阅 * @description 添加期刊订阅 + * @param name:journal_id type:int require:1 desc:期刊id + * @param name:email type:string require:1 desc:邮件地址 * @author wangjinlei * @url /api/Journal/addSubscribeJournal * @method POST - * - * @param name:journal_id type:int require:1 desc:期刊id - * @param name:email type:string require:1 desc:邮件地址 + * */ - public function addSubscribeJournal() { + public function addSubscribeJournal() + { $data = $this->request->post(); //去重 $repeat = $this->subscribe_journal_obj - ->where('journal_id', $data['journal_id']) - ->where('email', $data['email']) - ->where('state', 0) - ->find(); + ->where('journal_id', $data['journal_id']) + ->where('email', $data['email']) + ->where('state', 0) + ->find(); if ($repeat) { return jsonError('repeat subscribe!'); } @@ -1307,22 +1349,23 @@ class Journal extends Controller { /** * @title 添加期刊订阅通过issn * @description 添加期刊订阅通过issn + * @param name:issn type:string require:1 desc:issn号 + * @param name:email type:string require:1 desc:邮件地址 * @author wangjinlei * @url /api/Journal/addSubscribeByIssn * @method POST - * - * @param name:issn type:string require:1 desc:issn号 - * @param name:email type:string require:1 desc:邮件地址 + * */ - public function addSubscribeByIssn() { + public function addSubscribeByIssn() + { $data = $this->request->post(); $journal_info = $this->journal_obj->where('issn', $data['issn'])->find(); //去重 $repeat = $this->subscribe_journal_obj - ->where('journal_id', $journal_info['journal_id']) - ->where('email', $data['email']) - ->where('state', 0) - ->find(); + ->where('journal_id', $journal_info['journal_id']) + ->where('email', $data['email']) + ->where('state', 0) + ->find(); if ($repeat) { return jsonError('repeat subscribe!'); } @@ -1347,7 +1390,8 @@ class Journal extends Controller { return jsonSuccess([]); } - public function pushEmail() { + public function pushEmail() + { die; $list = $this->subscribe_journal_obj->where('journal_id', 1)->select(); @@ -1377,35 +1421,36 @@ class Journal extends Controller { /** * @title 获取期刊主页分期信息 * @description 获取期刊主页分期信息 + * @param name:journal_id type:int require:1 desc:期刊id + * + * @return stages:分期信息# * @author wangjinlei * @url /api/Journal/getMainPageStages * @method POST - * - * @param name:journal_id type:int require:1 desc:期刊id - * - * @return stages:分期信息# + * */ - public function getMainPageStages() { + public function getMainPageStages() + { $data = $this->request->post(); - $show_type = $this->journal_obj->where(['journal_id'=> $data['journal_id'],'state'=>0])->value('topic_show_type'); + $show_type = $this->journal_obj->where(['journal_id' => $data['journal_id'], 'state' => 0])->value('topic_show_type'); $frag = []; - if($show_type==0){ + if ($show_type == 0) { $list = $this->journal_stage_obj->where('journal_id', $data['journal_id'])->where('stage_year', date("Y"))->where('is_publish', 1)->where('state', 0)->order("stage_no desc")->select(); if (count($list) == 0) { $frag = $this->journal_stage_obj->where('journal_id', $data['journal_id'])->where('stage_year', date("Y", strtotime("-1 year")))->where('is_publish', 1)->where('state', 0)->order("stage_no desc")->select(); } else { $frag = $list; } - }else{ - $frag=$this->journal_stage_obj - ->where('journal_id', $data['journal_id']) - ->where('is_publish', 1) - ->where('state', 0) - ->order("stage_year desc,stage_no desc") - ->limit(1,4) - ->select(); + } else { + $frag = $this->journal_stage_obj + ->where('journal_id', $data['journal_id']) + ->where('is_publish', 1) + ->where('state', 0) + ->order("stage_year desc,stage_no desc") + ->limit(1, 4) + ->select(); } - $re['topic_show_type'] = $show_type; + $re['topic_show_type'] = $show_type; $re['stages'] = $frag; return jsonSuccess($re); } @@ -1413,14 +1458,15 @@ class Journal extends Controller { /** * @title 添加期刊话题订阅(批量) * @description 添加期刊话题订阅(批量) + * @param name:topic_ids type:string require:1 desc:期刊话题id(1,2,3,4) + * @param name:email type:string require:1 desc:邮箱地址 * @author wangjinlei * @url /api/Journal/addSubscribeTopics * @method POST - * - * @param name:topic_ids type:string require:1 desc:期刊话题id(1,2,3,4) - * @param name:email type:string require:1 desc:邮箱地址 + * */ - public function addSubscribeTopics() { + public function addSubscribeTopics() + { $data = $this->request->post(); // $topics = explode(',', $data['topic_ids']); $topics = $data['topic_ids']; @@ -1428,10 +1474,10 @@ class Journal extends Controller { foreach ($topics as $k => $v) { //去重 $repeat = $this->subscribe_topic_obj - ->where('topic_id', $v) - ->where('email', $data['email']) - ->where('state', 0) - ->find(); + ->where('topic_id', $v) + ->where('email', $data['email']) + ->where('state', 0) + ->find(); if ($repeat) { continue; } @@ -1464,21 +1510,22 @@ class Journal extends Controller { /** * @title 添加期刊话题订阅 * @description 添加期刊话题订阅 + * @param name:topic_id type:int require:1 desc:期刊话题id + * @param name:email type:string require:1 desc:邮箱地址 * @author wangjinlei * @url /api/Journal/addSubscribeTopic * @method POST - * - * @param name:topic_id type:int require:1 desc:期刊话题id - * @param name:email type:string require:1 desc:邮箱地址 + * */ - public function addSubscribeTopic() { + public function addSubscribeTopic() + { $data = $this->request->post(); //去重 $repeat = $this->subscribe_topic_obj - ->where('topic_id', $data['topic_id']) - ->where('email', $data['email']) - ->where('state', 0) - ->find(); + ->where('topic_id', $data['topic_id']) + ->where('email', $data['email']) + ->where('state', 0) + ->find(); if ($repeat) { return jsonError('repeat subscribe!'); } @@ -1505,21 +1552,22 @@ class Journal extends Controller { /** * @title 添加通用话题订阅 * @description 添加通用话题订阅 + * @param name:base_topic_id type:int require:1 desc:期刊话题id + * @param name:email type:string require:1 desc:邮箱地址 * @author wangjinlei * @url /api/Journal/addSubscribeBaseTopic * @method POST - * - * @param name:base_topic_id type:int require:1 desc:期刊话题id - * @param name:email type:string require:1 desc:邮箱地址 + * */ - public function addSubscribeBaseTopic() { + public function addSubscribeBaseTopic() + { $data = $this->request->post(); //去重 $repeat = $this->subscribe_base_topic_obj - ->where('base_topic_id', $data['base_topic_id']) - ->where('email', $data['email']) - ->where('state', 0) - ->find(); + ->where('base_topic_id', $data['base_topic_id']) + ->where('email', $data['email']) + ->where('state', 0) + ->find(); if ($repeat) { return jsonError('repeat subscribe!'); } @@ -1543,22 +1591,26 @@ class Journal extends Controller { return jsonSuccess([]); } - public function UnsubscribeTopic($snum) { + public function UnsubscribeTopic($snum) + { $this->subscribe_topic_obj->where('subscribe_topic_id', $snum)->update(['state' => 1]); echo 'Unsubscribe successfully!'; } - public function UnsubscribeBaseTopic($snum) { + public function UnsubscribeBaseTopic($snum) + { $this->subscribe_base_topic_obj->where('subscribe_base_topic_id', $snum)->update(['state' => 1]); echo 'Unsubscribe successfully!'; } - public function UnsubscribeJournal($snum) { + public function UnsubscribeJournal($snum) + { $this->subscribe_journal_obj->where('subscribe_journal_id', $snum)->update(['state' => 1]); echo 'Unsubscribe successfully!'; } - public function testEmail() { + public function testEmail() + { // phpinfo();die; @@ -1577,42 +1629,43 @@ class Journal extends Controller { /** * @title 查找文章 * @description 查找文章 - * @author wangjinlei - * @url /api/Journal/searchArticle - * @method POST - * * @param name:keyword type:string require:1 desc:关键词 * @param name:journal_id type:int require:1 desc:期刊id * @param name:pageIndex type:int require:1 desc:当前页码数 * @param name:pageSize type:int require:1 desc:单页数据条数 - * + * * @return articles:文章信息# * @return count:总数 + * @author wangjinlei + * @url /api/Journal/searchArticle + * @method POST + * */ - public function searchArticle() { + public function searchArticle() + { $data = $this->request->post(); $limit_start = ($data['pageIndex'] - 1) * $data['pageSize']; $arts = $this->article_author_obj->where('state', 0)->where("author_name like '%" . str_replace("'", "''", trim($data['keyword'])) . "%'")->column('article_id'); $list = $this->article_obj - ->where('journal_id', $data['journal_id']) - ->where('state', 0) + ->where('journal_id', $data['journal_id']) + ->where('state', 0) // ->where('article_id', 'in', $arts) // ->where('title like "%' . str_replace("'","''",trim($data['keyword'])) . '%" or abstract like "%' . str_replace("'","''",trim($data['keyword'])) . '%" or keywords like "%' . str_replace("'","''",trim($data['keyword'])) . '%"') - ->where(function($query)use($arts, $data) { - $query->where('article_id', 'in', $arts) + ->where(function ($query) use ($arts, $data) { + $query->where('article_id', 'in', $arts) ->whereOr("`title` like '%" . str_replace("'", "''", trim($data['keyword'])) . "%' or `abstract` like '%" . str_replace("'", "''", trim($data['keyword'])) . "%' or `keywords` like '%" . str_replace("'", "''", trim($data['keyword'])) . "%'"); - }) - ->orderRaw("(CASE WHEN title LIKE '%" . str_replace("'", "''", trim($data['keyword'])) . "%' THEN 1 ELSE 0 END) desc") - ->limit($limit_start, $data['pageSize']) - ->select(); + }) + ->orderRaw("(CASE WHEN title LIKE '%" . str_replace("'", "''", trim($data['keyword'])) . "%' THEN 1 ELSE 0 END) desc") + ->limit($limit_start, $data['pageSize']) + ->select(); $count = $this->article_obj - ->where('journal_id', $data['journal_id']) - ->where('state', 0) - ->where(function($query)use($arts, $data) { - $query->where('article_id', 'in', $arts) + ->where('journal_id', $data['journal_id']) + ->where('state', 0) + ->where(function ($query) use ($arts, $data) { + $query->where('article_id', 'in', $arts) ->whereOr('title|abstract|keywords', 'like', '%' . str_replace("'", "''", trim($data['keyword'])) . '%'); - }) - ->count(); + }) + ->count(); $has_list = []; //title含有关键字 $no_list = []; //title不含关键字 @@ -1648,35 +1701,36 @@ class Journal extends Controller { /** * @title 查找文章出版集团 * @description 查找文章出版集团 - * @author wangjinlei - * @url /api/Journal/searchArticleAll - * @method POST - * * @param name:keyword type:string require:1 desc:关键词 * @param name:pageIndex type:int require:1 desc:当前页码数 * @param name:pageSize type:int require:1 desc:单页数据条数 - * + * * @return articles:文章信息# * @return count:总数 + * @author wangjinlei + * @url /api/Journal/searchArticleAll + * @method POST + * */ - public function searchArticleAll() { + public function searchArticleAll() + { $data = $this->request->post(); $limit_start = ($data['pageIndex'] - 1) * $data['pageSize']; $arts = $this->article_author_obj->where('state', 0)->where('author_name', 'like', '%' . trim($data['keyword']) . '%')->column('article_id'); $list = $this->article_obj - ->where(function($query)use($arts, $data) { - $query->where('article_id', 'in', $arts) + ->where(function ($query) use ($arts, $data) { + $query->where('article_id', 'in', $arts) ->whereOr('title|abstract|keywords', 'like', '%' . trim($data['keyword']) . '%'); - }) - ->orderRaw("(CASE WHEN title LIKE '%" . trim($data['keyword']) . "%' THEN 1 ELSE 0 END) desc") - ->limit($limit_start, $data['pageSize']) - ->select(); + }) + ->orderRaw("(CASE WHEN title LIKE '%" . trim($data['keyword']) . "%' THEN 1 ELSE 0 END) desc") + ->limit($limit_start, $data['pageSize']) + ->select(); $count = $this->article_obj - ->where(function($query)use($arts, $data) { - $query->where('article_id', 'in', $arts) + ->where(function ($query) use ($arts, $data) { + $query->where('article_id', 'in', $arts) ->whereOr('title|abstract|keywords', 'like', '%' . trim($data['keyword']) . '%'); - }) - ->count(); + }) + ->count(); //补全信息,分期,作者 foreach ($list as $k => $v) { @@ -1709,16 +1763,17 @@ class Journal extends Controller { /** * @title 编委国际化 * @description 编委国际化 + * @param name:journal_id type:int require:1 desc:journal_id + * + * @return country:国家数组# + * @return count:总数 * @author wangjinlei * @url /api/Journal/getBWGJH * @method POST - * - * @param name:journal_id type:int require:1 desc:journal_id - * - * @return country:国家数组# - * @return count:总数 + * */ - public function getBWGJH() { + public function getBWGJH() + { $data = $this->request->post(); $list = $this->board_obj->where('journal_id', $data['journal_id'])->where('state', 0)->select(); $frag = []; @@ -1737,18 +1792,19 @@ class Journal extends Controller { /**编委国际化 * @return void */ - public function getBWGJH1(){ + public function getBWGJH1() + { $data = $this->request->post(); $rule = new Validate([ - "journal_id"=>"require" + "journal_id" => "require" ]); - if(!$rule->check($data)){ + if (!$rule->check($data)) { return jsonError($rule->getError()); } - $journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find(); + $journal_info = $this->journal_obj->where('journal_id', $data['journal_id'])->find(); $url = "http://api.tmrjournals.com/public/index.php/api/Web/getBWGJHByIssn"; $program['issn'] = $journal_info['issn']; - $res = object_to_array(json_decode(myPost($url,$program))); + $res = object_to_array(json_decode(myPost($url, $program))); $re = $res['data']; return jsonSuccess($re); } @@ -1756,10 +1812,6 @@ class Journal extends Controller { /** * @title 查找文章精确查找 * @description 查找文章精确查找 - * @author wangjinlei - * @url /api/Journal/searchDetail - * @method POST - * * @param name:term type:string require:0 desc:关键词 * @param name:author type:string require:0 desc:作者 * @param name:title type:string require:0 desc:标题 @@ -1768,11 +1820,16 @@ class Journal extends Controller { * @param name:journal_id type:int require:1 desc:journal_id(如果不限期刊请填0) * @param name:pageIndex type:int require:1 desc:当前页码数 * @param name:pageSize type:int require:1 desc:单页数据条数 - * + * * @return articles:文章信息# * @return count:总数 + * @author wangjinlei + * @url /api/Journal/searchDetail + * @method POST + * */ - public function searchDetail() { + public function searchDetail() + { $data = $this->request->post(); $limit_start = ($data['pageIndex'] - 1) * $data['pageSize']; @@ -1825,12 +1882,12 @@ class Journal extends Controller { $where_str = $where_str == '' ? 'state = 0' : 'state = 0 and ' . $where_str; $list = $this->article_obj - ->where($where_str) - ->limit($limit_start, $data['pageSize']) - ->select(); + ->where($where_str) + ->limit($limit_start, $data['pageSize']) + ->select(); $count = $this->article_obj - ->where($where_str) - ->count(); + ->where($where_str) + ->count(); //补全信息,分期,作者 foreach ($list as $k => $v) { $stage_info = $this->journal_stage_obj->where('journal_stage_id', $v['journal_stage_id'])->find(); @@ -1862,10 +1919,6 @@ class Journal extends Controller { /** * @title 查找文章精确查找(新) * @description 查找文章精确查找(新) - * @author wangjinlei - * @url /api/Journal/searchArticleMenu - * @method POST - * * @param name:key1 type:string require:1 desc:第一个条件(title,abstract,keywords,author) * @param name:val1 type:string require:1 desc:第一个值 * @param name:oper type:string require:0 desc:运算符(and\or) @@ -1874,11 +1927,16 @@ class Journal extends Controller { * @param name:journal_id type:int require:1 desc:journal_id(demo:1,2,3) * @param name:pageIndex type:int require:1 desc:当前页码数 * @param name:pageSize type:int require:1 desc:单页数据条数 - * + * * @return articles:文章信息# * @return count:总数 + * @author wangjinlei + * @url /api/Journal/searchArticleMenu + * @method POST + * */ - public function searchArticleMenu() { + public function searchArticleMenu() + { $data = $this->request->post(); $limit_start = ($data['pageIndex'] - 1) * $data['pageSize']; @@ -1888,7 +1946,7 @@ class Journal extends Controller { if ($data['key1'] == 'author') { $arts = $this->article_author_obj->where('state', 0)->where('author_name|email', 'like', '%' . trim($data['val1']) . '%')->column('article_id'); $a_str = '(' . implode(',', $arts) . ')'; - if($a_str=="()"){ + if ($a_str == "()") { $cre['articles'] = []; $cre['count'] = 0; return jsonSuccess($cre); @@ -1928,13 +1986,13 @@ class Journal extends Controller { } $list = $this->article_obj - ->where($where_str) - ->orderRaw($order_str) - ->limit($limit_start, $data['pageSize']) - ->select(); + ->where($where_str) + ->orderRaw($order_str) + ->limit($limit_start, $data['pageSize']) + ->select(); $count = $this->article_obj - ->where($where_str) - ->count(); + ->where($where_str) + ->count(); //补全信息,分期,作者 foreach ($list as $k => $v) { $stage_info = $this->journal_stage_obj->where('journal_stage_id', $v['journal_stage_id'])->find(); @@ -1973,14 +2031,15 @@ class Journal extends Controller { * @title 获取期刊编辑 * @description 获取期刊编辑接口 */ - private function getJournalBoard($aParam = []){ + private function getJournalBoard($aParam = []) + { $sIssn = empty($aParam['issn']) ? '' : $aParam['issn']; - if(empty($sIssn)){ - return json_encode(['status' => 2,'msg' => 'Parameter is empty']); + if (empty($sIssn)) { + return json_encode(['status' => 2, 'msg' => 'Parameter is empty']); } $sUrl = "http://api.tmrjournals.com/public/index.php/api/Supplementary/getJournalBoard"; - $aResult = json_decode(myPost($sUrl,$aParam),true); + $aResult = json_decode(myPost($sUrl, $aParam), true); return $aResult; - } + } } diff --git a/application/api/controller/Main.php b/application/api/controller/Main.php index 6d8027e..b9f14ac 100644 --- a/application/api/controller/Main.php +++ b/application/api/controller/Main.php @@ -140,17 +140,19 @@ class Main extends Controller { */ public function getMainArticles(){ $list_tmr = $this->article_obj->field('j_article.*,j_journal_stage.*,j_journal.title journal_title,j_journal.jabbr journal_short,j_journal.usx usx')->join(array(['j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT'],['j_journal','j_article.journal_id = j_journal.journal_id','LEFT']))->where('j_article.journal_id',1)->where('j_journal_stage.is_publish',1)->where('j_article.state',0)->order('j_article.article_id desc')->limit(1)->select(); - $list_zh = $this->article_obj->field('j_article.*,j_journal_stage.*,j_journal.title journal_title,j_journal.jabbr journal_short,j_journal.usx usx')->join(array(['j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT'],['j_journal','j_article.journal_id = j_journal.journal_id','LEFT']))->where('j_article.journal_id',2)->where('j_journal_stage.is_publish',1)->where('j_article.state',0)->order('j_article.article_id desc')->limit(1)->select(); - $list_life = $this->article_obj->field('j_article.*,j_journal_stage.*,j_journal.title journal_title,j_journal.jabbr journal_short,j_journal.usx usx')->join(array(['j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT'],['j_journal','j_article.journal_id = j_journal.journal_id','LEFT']))->where('j_article.journal_id',8)->where('j_journal_stage.is_publish',1)->where('j_article.state',0)->order('j_article.article_id desc')->limit(1)->select(); - $list_fyw = $this->article_obj->field('j_article.*,j_journal_stage.*,j_journal.title journal_title,j_journal.jabbr journal_short,j_journal.usx usx')->join(array(['j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT'],['j_journal','j_article.journal_id = j_journal.journal_id','LEFT']))->where('j_article.journal_id',25)->where('j_journal_stage.is_publish',1)->where('j_article.state',0)->order('j_article.article_id desc')->limit(1)->select(); - $list_ywlh = $this->article_obj->field('j_article.*,j_journal_stage.*,j_journal.title journal_title,j_journal.jabbr journal_short,j_journal.usx usx')->join(array(['j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT'],['j_journal','j_article.journal_id = j_journal.journal_id','LEFT']))->where('j_article.journal_id',11)->where('j_journal_stage.is_publish',1)->where('j_article.state',0)->order('j_article.article_id desc')->limit(1)->select(); - $list_zy = $this->article_obj->field('j_article.*,j_journal_stage.*,j_journal.title journal_title,j_journal.jabbr journal_short,j_journal.usx usx')->join(array(['j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT'],['j_journal','j_article.journal_id = j_journal.journal_id','LEFT']))->where('j_article.journal_id',17)->where('j_journal_stage.is_publish',1)->where('j_article.state',0)->order('j_article.article_id desc')->limit(1)->select(); + $list_zh = $this->article_obj->field('j_article.*,j_journal_stage.*,j_journal.title journal_title,j_journal.jabbr journal_short,j_journal.usx usx')->join(array(['j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT'],['j_journal','j_article.journal_id = j_journal.journal_id','LEFT']))->where('j_article.journal_id',17)->where('j_journal_stage.is_publish',1)->where('j_article.state',0)->order('j_article.article_id desc')->limit(1)->select(); + $list_life = $this->article_obj->field('j_article.*,j_journal_stage.*,j_journal.title journal_title,j_journal.jabbr journal_short,j_journal.usx usx')->join(array(['j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT'],['j_journal','j_article.journal_id = j_journal.journal_id','LEFT']))->where('j_article.journal_id',25)->where('j_journal_stage.is_publish',1)->where('j_article.state',0)->order('j_article.article_id desc')->limit(1)->select(); + $list_fyw = $this->article_obj->field('j_article.*,j_journal_stage.*,j_journal.title journal_title,j_journal.jabbr journal_short,j_journal.usx usx')->join(array(['j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT'],['j_journal','j_article.journal_id = j_journal.journal_id','LEFT']))->where('j_article.journal_id',11)->where('j_journal_stage.is_publish',1)->where('j_article.state',0)->order('j_article.article_id desc')->limit(1)->select(); + $list_ywlh = $this->article_obj->field('j_article.*,j_journal_stage.*,j_journal.title journal_title,j_journal.jabbr journal_short,j_journal.usx usx')->join(array(['j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT'],['j_journal','j_article.journal_id = j_journal.journal_id','LEFT']))->where('j_article.journal_id',14)->where('j_journal_stage.is_publish',1)->where('j_article.state',0)->order('j_article.article_id desc')->limit(1)->select(); + $list_zy = $this->article_obj->field('j_article.*,j_journal_stage.*,j_journal.title journal_title,j_journal.jabbr journal_short,j_journal.usx usx')->join(array(['j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT'],['j_journal','j_article.journal_id = j_journal.journal_id','LEFT']))->where('j_article.journal_id',4)->where('j_journal_stage.is_publish',1)->where('j_article.state',0)->order('j_article.article_id desc')->limit(1)->select(); + $list_zy1 = $this->article_obj->field('j_article.*,j_journal_stage.*,j_journal.title journal_title,j_journal.jabbr journal_short,j_journal.usx usx')->join(array(['j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT'],['j_journal','j_article.journal_id = j_journal.journal_id','LEFT']))->where('j_article.journal_id',8)->where('j_journal_stage.is_publish',1)->where('j_article.state',0)->order('j_article.article_id desc')->limit(1)->select(); $list = $list_tmr; $list[] = $list_zh[0]; $list[] = $list_life[0]; $list[] = $list_fyw[0]; $list[] = $list_ywlh[0]; $list[] = $list_zy[0]; + $list[] = $list_zy1[0]; foreach ($list as $k => $v) { $list[$k]['authortitle'] = $this->getAuthor($v); }