diff --git a/application/api/controller/Article.php b/application/api/controller/Article.php index e6a9287..1cc70bf 100644 --- a/application/api/controller/Article.php +++ b/application/api/controller/Article.php @@ -361,40 +361,9 @@ class Article extends Controller { ->where('j_article_to_topic.state', 0) // ->where('j_journal_stage.stage_year','>',intval(date('Y'))-3) ->count(); - //获取作者 - foreach ($list as $k => $v) { - $stage_info = $this->journal_stage_obj->where('journal_stage_id', $v['journal_stage_id'])->find(); - //组合cite信息 - $no = $stage_info['stage_no'] == 0 ? ':' : '(' . $stage_info['stage_no'] . '):'; - $cite = $v['abbr'] . '. ' . $v['title'] . '. ' . choiseJabbr($v['article_id'], $journal_info['jabbr']) . '. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi']; - $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; - $list[$k]['cite'] = $cite; - $list[$k]['authortitle'] = $this->getAuthor($v); - $list[$k]['html'] = hasHtml($v['article_id']); -// $list[$k]['mains'] = getArticleMains($v['article_id']); - } - //标题斜体 - 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, '' . $val . '', $cache_title); - } - $list[$k]['title'] = $cache_title; - } - //连续出版判断,决定是否显示出版时间 - foreach ($list as $k => $v){ - $ca_stage = $this->journal_stage_obj->where('journal_stage_id',$v['journal_stage_id'])->find(); - if(($v['journal_id']==2&&$ca_stage['stage_year']>=2022)||($v['journal_id']==18&&$ca_stage['stage_year']>=2022)||($v['journal_id']==17&&$ca_stage['stage_year']>=2019)){ - $list[$k]['isShowOtime'] = 1; - }else{ - $list[$k]['isShowOtime'] = 0; - } - } $re['topicInfo'] = $topic_info; - $re['articleList'] = $list; + $re['articleList'] = strongArticleList($list); $re['count'] = $count; return jsonSuccess($re); } @@ -443,43 +412,7 @@ class Article extends Controller { ->where('j_article.state', 0) ->order($order) ->select(); - //获取作者 - foreach ($list as $k => $v) { - $stage_info = $this->journal_stage_obj->where('journal_stage_id', $v['journal_stage_id'])->find(); - //组合cite信息 - $no = $stage_info['stage_no'] == 0 ? ':' : '(' . $stage_info['stage_no'] . '):'; - $cite = $v['abbr'] . '. ' . $v['title'] . '. ' . choiseJabbr($v['article_id'], $journal_info['jabbr']) . '. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi']; - $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; - $list[$k]['cite'] = $cite; - $list[$k]['journal_title'] = choiseti1($v['article_id'],$journal_info['title']); - $list[$k]['authortitle'] = $this->getAuthor($v); - - $list[$k]['mains'] = [];//getArticleMains($v['article_id']); - $cm = $this->article_main_obj->where('article_id',$v['article_id'])->where('state',0)->find(); - $list[$k]['has_mains'] = $cm?1:0; - $list[$k]["cite_num"] = $this->article_cite_obj->where("article_id",$v['article_id'])->where("state",1)->where("is_wos",1)->count(); - } - //标题斜体 - 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, '' . $val . '', $cache_title); - } - $list[$k]['title'] = $cache_title; - } - //连续出版判断,决定是否显示出版时间 - foreach ($list as $k => $v){ - $ca_stage = $this->journal_stage_obj->where('journal_stage_id',$v['journal_stage_id'])->find(); - if(($v['journal_id']==2&&$ca_stage['stage_year']>=2022)||($v['journal_id']==18&&$ca_stage['stage_year']>=2022)||($v['journal_id']==17&&$ca_stage['stage_year']>=2019)){ - $list[$k]['isShowOtime'] = 1; - }else{ - $list[$k]['isShowOtime'] = 0; - } - } - $l = choiseJtitle($list); + $l = strongArticleList(choiseJtitle($list)); $re['stageInfo'] = $stage_info; $re['articleList'] = $l; return jsonSuccess($re); @@ -566,39 +499,7 @@ class Article extends Controller { ->where('j_journal_stage.is_publish', 1) ->where('j_journal_stage.stage_year', '>=', '2019') ->count(); - //获取作者 - foreach ($list as $k => $v) { - $stage_info = $this->journal_stage_obj->where('journal_stage_id', $v['journal_stage_id'])->find(); - //组合cite信息 - $no = $stage_info['stage_no'] == 0 ? ':' : '(' . $stage_info['stage_no'] . '):'; - $cite = $v['abbr'] . '. ' . $v['title'] . '. ' . choiseJabbr($v['article_id'], $journal_info['jabbr']) . '. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi']; - $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; - $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'); - $cache_title = $v['title']; - foreach ($caches as $val) { - $cache_title = str_replace($val, '' . $val . '', $cache_title); - } - $list[$k]['title'] = $cache_title; - } - //连续出版判断,决定是否显示出版时间 - foreach ($list as $k => $v){ - $ca_stage = $this->journal_stage_obj->where('journal_stage_id',$v['journal_stage_id'])->find(); - if(($v['journal_id']==2&&$ca_stage['stage_year']>=2022)||($v['journal_id']==18&&$ca_stage['stage_year']>=2022)||($v['journal_id']==17&&$ca_stage['stage_year']>=2019)){ - $list[$k]['isShowOtime'] = 1; - }else{ - $list[$k]['isShowOtime'] = 0; - } - } - - $re['articleList'] = $list; + $re['articleList'] = strongArticleList($list); $re['count'] = $count; return jsonSuccess($re); } diff --git a/application/api/controller/Journal.php b/application/api/controller/Journal.php index 2e49839..b41fd8b 100644 --- a/application/api/controller/Journal.php +++ b/application/api/controller/Journal.php @@ -352,46 +352,8 @@ class Journal extends Controller { ->where('j_article_to_line.state', 0) ->order('j_article.sort desc') ->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, '' . $val . '', $cache_title); - } - $list[$k]['title'] = $cache_title; - } - - //获取作者 - foreach ($list as $k => $v) { - $stage_info = $this->journal_stage_obj->where('journal_stage_id', $v['journal_stage_id'])->find(); - //组合cite信息 - $no = $stage_info['stage_no'] == 0 ? ':' : '(' . $stage_info['stage_no'] . '):'; - $cite = $v['abbr'] . '. ' . $v['title'] . '. ' . choiseJabbr($v['article_id'], $journal_info['jabbr']) . '. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi']; - $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; - $list[$k]['cite'] = $cite; - $list[$k]['authortitle'] = $this->getAuthor($v); - } - - //连续出版判断,决定是否显示出版时间 - foreach ($list as $k => $v) { - $ca_stage = $this->journal_stage_obj->where('journal_stage_id', $v['journal_stage_id'])->find(); - if (($v['journal_id'] == 2 && $ca_stage['stage_year'] >= 2022) || ($v['journal_id'] == 18 && $ca_stage['stage_year'] >= 2022) || ($v['journal_id'] == 17 && $ca_stage['stage_year'] >= 2019)) { - $list[$k]['isShowOtime'] = 1; - } else { - $list[$k]['isShowOtime'] = 0; - } - } - -// //获取作者 -// foreach ($list as $k => $v) { -// $list[$k]['authortitle'] = $this->getAuthor($v); -// } - $re['journalLine'] = $journalLine; - $re['articles'] = $list; + $re['articles'] = strongArticleList($list); return jsonSuccess($re); } @@ -582,40 +544,8 @@ class Journal extends Controller { ->where('j_article.article_id', 'in', $ids) ->where('j_article.state', 0) ->count(); - //获取作者 - foreach ($list as $k => $v) { - $stage_info = $this->journal_stage_obj->where('journal_stage_id', $v['journal_stage_id'])->find(); - $journal_info = $this->journal_obj->where('journal_id', $v['journal_id'])->find(); - //组合cite信息 - $no = $stage_info['stage_no'] == 0 ? ':' : '(' . $stage_info['stage_no'] . '):'; - $cite = $v['abbr'] . '. ' . $v['title'] . '. ' . choiseJabbr($v['article_id'], $journal_info['jabbr']) . '. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi']; - $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; - $list[$k]['cite'] = $cite; - $list[$k]['authortitle'] = $this->getAuthor($v); - } - //连续出版判断,决定是否显示出版时间 - foreach ($list as $k => $v) { - $ca_stage = $this->journal_stage_obj->where('journal_stage_id', $v['journal_stage_id'])->find(); - if (($v['journal_id'] == 2 && $ca_stage['stage_year'] >= 2022) || ($v['journal_id'] == 18 && $ca_stage['stage_year'] >= 2022) || ($v['journal_id'] == 17 && $ca_stage['stage_year'] >= 2019)) { - $list[$k]['isShowOtime'] = 1; - } else { - $list[$k]['isShowOtime'] = 0; - } - } - - //标题斜体 - 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, '' . $val . '', $cache_title); - } - $list[$k]['title'] = $cache_title; - } $re['topic'] = $base_topic_info; - $re['articleList'] = $list; + $re['articleList'] = strongArticleList($list);; $re['count'] = $count; return jsonSuccess($re); } @@ -646,47 +576,7 @@ class Journal extends Controller { ->order($order) ->select(); $stage_info = $this->journal_stage_obj->where('journal_stage_id', $journal_info['publish_stage_id'])->find(); - //标题斜体 - 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, '' . $val . '', $cache_title); - } - $list[$k]['title'] = $cache_title; - $list[$k]['mains'] = [];//getArticleMains($v['article_id']); - $cm = $this->article_main_obj->where('article_id',$v['article_id'])->where('state',0)->find(); - $list[$k]['has_mains'] = $cm?1:0; - $list[$k]["cite_num"] = $this->article_cite_obj->where("article_id",$v['article_id'])->where("state",1)->where("is_wos",1)->count(); - } - - //获取作者 - foreach ($list as $k => $v) { - //组合cite信息 - $no = $stage_info['stage_no'] == 0 ? ':' : '(' . $stage_info['stage_no'] . '):'; - if ($journal_info['journal_id'] == 22) { - $cite = $v['abbr'] . '. ' . $v['title'] . '[J]. ' . $journal_info['jabbr'] . ',' . $stage_info['stage_year'] . ',' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi']; - } else { - $cite = $v['abbr'] . '. ' . $v['title'] . '. ' . choiseJabbr($v['article_id'], $journal_info['jabbr']) . '. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi']; - } - $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; - $list[$k]['cite'] = $cite; - $list[$k]['journal_title'] = choiseti1($v['article_id'],$journal_info['title']); - $list[$k]['authortitle'] = $this->getAuthor($v); - } - - //连续出版判断,决定是否显示出版时间 - foreach ($list as $k => $v) { - $ca_stage = $this->journal_stage_obj->where('journal_stage_id', $v['journal_stage_id'])->find(); - if (($v['journal_id'] == 2 && $ca_stage['stage_year'] >= 2022) || ($v['journal_id'] == 18 && $ca_stage['stage_year'] >= 2022) || ($v['journal_id'] == 17 && $ca_stage['stage_year'] >= 2019)) { - $list[$k]['isShowOtime'] = 1; - } else { - $list[$k]['isShowOtime'] = 0; - } - } - return json(['code' => 0, 'msg' => 'success', 'data' => ['stage' => $stage_info, 'articleList' => $list]]); + return json(['code' => 0, 'msg' => 'success', 'data' => ['stage' => $stage_info, 'articleList' => strongArticleList($list)]]); } private function getAuthor($article) { @@ -790,40 +680,8 @@ class Journal extends Controller { ->where('j_article.journal_stage_id', 'in', $stages) ->where('j_article.state', 0) ->count(); - //标题斜体 - 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, '' . $val . '', $cache_title); - } - $list[$k]['title'] = $cache_title; - $list[$k]['mains'] = getArticleMains($v['article_id']); - } - //获取作者 - foreach ($list as $k => $v) { - $stage_info = $this->journal_stage_obj->where('journal_stage_id', $v['journal_stage_id'])->find(); - //组合cite信息 - $no = $stage_info['stage_no'] == 0 ? ':' : '(' . $stage_info['stage_no'] . '):'; - $cite = $v['abbr'] . '. ' . $v['title'] . '. ' . choiseJabbr($v['article_id'], $journal_info['jabbr']) . '. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi']; - $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; - $list[$k]['cite'] = $cite; - $list[$k]['authortitle'] = $this->getAuthor($v); - } - - //连续出版判断,决定是否显示出版时间 - foreach ($list as $k => $v) { - $ca_stage = $this->journal_stage_obj->where('journal_stage_id', $v['journal_stage_id'])->find(); - if (($v['journal_id'] == 2 && $ca_stage['stage_year'] >= 2022) || ($v['journal_id'] == 18 && $ca_stage['stage_year'] >= 2022) || ($v['journal_id'] == 17 && $ca_stage['stage_year'] >= 2019)) { - $list[$k]['isShowOtime'] = 1; - } else { - $list[$k]['isShowOtime'] = 0; - } - } - return json(['code' => 0, 'msg' => 'success', 'data' => ['articlelist' => $list, 'count' => $count]]); + return json(['code' => 0, 'msg' => 'success', 'data' => ['articlelist' => strongArticleList($list), 'count' => $count]]); } /** @@ -851,42 +709,7 @@ class Journal extends Controller { ->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(); - //获取作者 - foreach ($list as $k => $v) { - $stage_info = $this->journal_stage_obj->where('journal_stage_id', $v['journal_stage_id'])->find(); - //组合cite信息 - $no = $stage_info['stage_no'] == 0 ? ':' : '(' . $stage_info['stage_no'] . '):'; - $cite = $v['abbr'] . '. ' . $v['title'] . '. ' . choiseJabbr($v['article_id'], $journal_info['jabbr']) . '. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi']; - $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; - $list[$k]['cite'] = $cite; - $list[$k]['authortitle'] = $this->getAuthor($v); - $list[$k]['html'] = hasHtml($v['article_id']); - -// $list[$k]['mains'] = getArticleMains($v['article_id']); - } - //标题斜体 - 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, '' . $val . '', $cache_title); - } - $list[$k]['title'] = $cache_title; - } - - //连续出版判断,决定是否显示出版时间 - foreach ($list as $k => $v) { - $ca_stage = $this->journal_stage_obj->where('journal_stage_id', $v['journal_stage_id'])->find(); - if (($v['journal_id'] == 2 && $ca_stage['stage_year'] >= 2022) || ($v['journal_id'] == 18 && $ca_stage['stage_year'] >= 2022) || ($v['journal_id'] == 17 && $ca_stage['stage_year'] >= 2019)) { - $list[$k]['isShowOtime'] = 1; - } else { - $list[$k]['isShowOtime'] = 0; - } - } - - return json(['code' => 0, 'msg' => 'success', 'data' => ['articlelist' => $list]]); + return json(['code' => 0, 'msg' => 'success', 'data' => ['articlelist' => strongArticleList($list)]]); } @@ -1014,41 +837,7 @@ class Journal extends Controller { if($count>50){//只显示前50片 $count = 50; } - - //获取作者 - foreach ($list as $k => $v) { - $stage_info = $this->journal_stage_obj->where('journal_stage_id', $v['journal_stage_id'])->find(); - //组合cite信息 - $no = $stage_info['stage_no'] == 0 ? ':' : '(' . $stage_info['stage_no'] . '):'; - $cite = $v['abbr'] . '. ' . $v['title'] . '. ' . choiseJabbr($v['article_id'], $journal_info['jabbr']) . '. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi']; - $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; - $list[$k]['cite'] = $cite; - $list[$k]['authortitle'] = $this->getAuthor($v); - $list[$k]['html'] = hasHtml($v['article_id']); -// $list[$k]['mains'] = getArticleMains($v['article_id']); - } - //连续出版判断,决定是否显示出版时间 - foreach ($list as $k => $v){ - $ca_stage = $this->journal_stage_obj->where('journal_stage_id',$v['journal_stage_id'])->find(); - if(($v['journal_id']==2&&$ca_stage['stage_year']>=2022)||($v['journal_id']==18&&$ca_stage['stage_year']>=2022)||($v['journal_id']==17&&$ca_stage['stage_year']>=2019)){ - $list[$k]['isShowOtime'] = 1; - }else{ - $list[$k]['isShowOtime'] = 0; - } - } - - //标题斜体 - 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, '' . $val . '', $cache_title); - } - $list[$k]['title'] = $cache_title; - } - return jsonSuccess(['articles' => $list, 'count' => $count]); + return jsonSuccess(['articles' => strongArticleList($list), 'count' => $count]); } /** diff --git a/application/api/controller/Main.php b/application/api/controller/Main.php index 000c33e..27bcee3 100644 --- a/application/api/controller/Main.php +++ b/application/api/controller/Main.php @@ -170,48 +170,7 @@ class Main extends Controller { public function getMoreArticles(){ $sql = "select a.* from (select MAX(article_id) aid from j_article WHERE state = 0 and journal_id in (select journal_id from j_journal where state = 0) GROUP BY journal_id) c left join j_article a on a.article_id = c.aid"; $list = Db::query($sql); - - //获取作者 - foreach ($list as $k => $v) { - $stage_info = $this->journal_stage_obj->where('journal_stage_id', $v['journal_stage_id'])->find(); - $journal_info = $this->journal_obj->where('journal_id', $v['journal_id'])->find(); - //组合cite信息 - $no = $stage_info['stage_no'] == 0 ? ':' : '(' . $stage_info['stage_no'] . '):'; - $cite = $v['abbr'] . '. ' . $v['title'] . '. ' . choiseJabbr($v['article_id'],$journal_info['jabbr']) . '. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi']; - $list[$k]['cite'] = $cite; - $list[$k]['authortitle'] = $this->getAuthor($v); - $list[$k] = array_merge($list[$k],$stage_info); - $list[$k]['journal_title'] = $journal_info['title']; - $list[$k]['journal_short'] = $journal_info['jabbr']; - } - - //标题斜体 - 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, '' . $val . '', $cache_title); - } - $list[$k]['title'] = $cache_title; - $list[$k]['html'] = hasHtml($v['article_id']); - -// $list[$k]['mains'] = getArticleMains($v['article_id']); - } - - //连续出版判断,决定是否显示出版时间 - foreach ($list as $k => $v){ - $ca_stage = $this->journal_stage_obj->where('journal_stage_id',$v['journal_stage_id'])->find(); - if(($v['journal_id']==2&&$ca_stage['stage_year']>=2022)||($v['journal_id']==18&&$ca_stage['stage_year']>=2022)||($v['journal_id']==17&&$ca_stage['stage_year']>=2019)){ - $list[$k]['isShowOtime'] = 1; - }else{ - $list[$k]['isShowOtime'] = 0; - } - } - -// foreach ($list as $k => $v) { -// $list[$k]['authortitle'] = $this->getAuthor($v); -// } - $re['articles'] = $list; + $re['articles'] = strongArticleList($list); return jsonSuccess($re); } @@ -247,23 +206,7 @@ class Main extends Controller { ->where('j_journal_stage.is_publish',0) ->where('j_article.journal_id','in','1,4,7,8,10,6,14,11,15,17,20,21,22,23,25') ->count(); - //标题斜体 - 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, '' . $val . '', $cache_title); - } - $list[$k]['title'] = $cache_title; - - $list[$k]['mains'] = getArticleMains($v['article_id']); - } - - - foreach ($list as $k => $v) { - $list[$k]['authortitle'] = $this->getAuthor($v); - } - $re['articles'] = $list; + $re['articles'] = strongArticleList($list); $re['count'] = $count; return jsonSuccess($re); } @@ -295,38 +238,7 @@ class Main extends Controller { ->where('j_article.type', $type) ->order('j_article.article_id desc') ->select(); - //获取作者 - foreach ($list as $k => $v) { - $stage_info = $this->journal_stage_obj->where('journal_stage_id', $v['journal_stage_id'])->find(); - $journal_info = $this->journal_obj->where('journal_id', $v['journal_id'])->find(); - //组合cite信息 - $no = $stage_info['stage_no'] == 0 ? ':' : '(' . $stage_info['stage_no'] . '):'; - $cite = $v['abbr'] . '. ' . $v['title'] . '. ' . choiseJabbr($v['article_id'],$journal_info['jabbr']) . '. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi']; - $list[$k]['cite'] = $cite; - $list[$k]['authortitle'] = $this->getAuthor($v); - - $list[$k]['mains'] = getArticleMains($v['article_id']); - } - - //标题斜体 - 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, '' . $val . '', $cache_title); - } - $list[$k]['title'] = $cache_title; - } - //连续出版判断,决定是否显示出版时间 - foreach ($list as $k => $v){ - $ca_stage = $this->journal_stage_obj->where('journal_stage_id',$v['journal_stage_id'])->find(); - if(($v['journal_id']==2&&$ca_stage['stage_year']>=2022)||($v['journal_id']==18&&$ca_stage['stage_year']>=2022)||($v['journal_id']==17&&$ca_stage['stage_year']>=2019)){ - $list[$k]['isShowOtime'] = 1; - }else{ - $list[$k]['isShowOtime'] = 0; - } - } - $re['articles'] = $list; + $re['articles'] = strongArticleList($list); return jsonSuccess($re); } @@ -456,29 +368,7 @@ class Main extends Controller { if($count>50){ $count=50; } - //获取作者 - foreach ($list as $k => $v) { - $stage_info = $this->journal_stage_obj->where('journal_stage_id', $v['journal_stage_id'])->find(); - $journal_info = $this->journal_obj->where('journal_id', $v['journal_id'])->find(); - //组合cite信息 - $no = $stage_info['stage_no'] == 0 ? ':' : '(' . $stage_info['stage_no'] . '):'; - $cite = $v['abbr'] . '. ' . $v['title'] . '. ' . choiseJabbr($v['article_id'],$journal_info['jabbr']) . '. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi']; - $list[$k]['cite'] = $cite; - $list[$k]['authortitle'] = $this->getAuthor($v); - - $list[$k]['mains'] = getArticleMains($v['article_id']); - } - - //标题斜体 - 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, '' . $val . '', $cache_title); - } - $list[$k]['title'] = $cache_title; - } - return jsonSuccess(['articles' => $list,'count'=>$count]); + return jsonSuccess(['articles' => strongArticleList($list),'count'=>$count]); } diff --git a/application/api/controller/Tmrde.php b/application/api/controller/Tmrde.php index d35817d..414a084 100644 --- a/application/api/controller/Tmrde.php +++ b/application/api/controller/Tmrde.php @@ -77,25 +77,9 @@ class Tmrde extends Controller{ ->where('j_article.article_id','in',$article_ids) ->where('j_article.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, '' . $val . '', $cache_title); - } - $list[$k]['title'] = $cache_title; - - $list[$k]['mains'] = getArticleMains($v['article_id']); - } - - - foreach ($list as $k => $v) { - $list[$k]['authortitle'] = $this->getAuthor($v); - } $re['medicament'] = $med_info; - $re['articles'] = $list; + $re['articles'] = strongArticleList($list); return jsonSuccess($re); } diff --git a/application/common.php b/application/common.php index 8837a8a..a04b824 100644 --- a/application/common.php +++ b/application/common.php @@ -288,6 +288,7 @@ function strongArticleList($list){ $journal_stage_obj = Db::name("journal_stage"); $journal_obj = Db::name("journal"); $journals_ltai_obj = Db::name("article_ltai"); + $article_cite_obj = Db::name("article_cite"); foreach ($list as $k => $v) { $stage_info = $journal_stage_obj->where('journal_stage_id', $v['journal_stage_id'])->find(); $journal_info = $journal_obj->where('journal_id', $v['journal_id'])->find(); @@ -298,6 +299,7 @@ function strongArticleList($list){ $list[$k]['authortitle'] = getAuthor($v); $list[$k]["mains"] = null; $list[$k]['has_html'] = hasHtml($v['article_id']); + $list[$k]["cite_num"] = $article_cite_obj->where("article_id",$v['article_id'])->where("state",1)->where("is_wos",1)->count(); $list[$k]['stage_year'] = $stage_info['stage_year']; $list[$k]['journal_short'] = $journal_info["jabbr"]; $list[$k]['journal_title'] = $journal_info['title'];