From f1279814b2221aa38fb1f535233bd8389f1805b4 Mon Sep 17 00:00:00 2001 From: wangjinlei <751475802@qq.com> Date: Fri, 12 May 2023 14:40:08 +0800 Subject: [PATCH] 1 --- application/master/controller/Submision.php | 52 +++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/application/master/controller/Submision.php b/application/master/controller/Submision.php index bc1506a..040ccae 100644 --- a/application/master/controller/Submision.php +++ b/application/master/controller/Submision.php @@ -74,4 +74,56 @@ class Submision extends Controller { } + public function getArticlesByStage(){ + $data = $this->request->post(); + $rule = new Validate([ + "journal_stage_id"=>"require" + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + $list = $this->article_obj->where('journal_stage_id',$data['journal_stage_id'])->where('state',0)->order('sort')->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) { + $journal_info = $this->journal_obj->where('journal_id',$v['journal_id'])->find(); + $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'] . '):'; + 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); + } + $re['articles'] = $list; + return jsonSuccess($re); + } + + private function getAuthor($article) + { + $where['article_id'] = $article['article_id']; + $where['state'] = 0; + $list = $this->article_author_obj->where($where)->select(); + $frag = ''; + foreach ($list as $k => $v) { + $frag = $frag == '' ? '' . $v['author_name'] : $frag . ', ' . $v['author_name']; + } + return $frag; + } + }