diff --git a/application/api/controller/Article.php b/application/api/controller/Article.php index 60627be..0dfe39c 100644 --- a/application/api/controller/Article.php +++ b/application/api/controller/Article.php @@ -122,20 +122,28 @@ class Article extends Controller { * @method POST * * @param name: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 topicInfo:话题信息# * @return articleList:文章信息# - * + * @return count:总数 */ public function getTopicArticles() { $data = $this->request->post(); $topic_info = $this->journal_topic_obj->where('journal_topic_id', $data['topic_id'])->find(); $journal_info = $this->journal_obj->where('journal_id',$topic_info['journal_id'])->find(); + $limit_start = ($data['pageIndex'] - 1) * $data['pageSize']; $list = $this->article_to_topic_obj->field('j_article.*,j_journal_stage.*') ->join(array(['j_article', 'j_article_to_topic.article_id = j_article.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', $data['topic_id']) ->where('j_article_to_topic.state', 0) + ->limit($limit_start,$data['pageSize']) ->select(); + $count = $this->article_to_topic_obj + ->where('j_article_to_topic.topic_id', $data['topic_id']) + ->where('j_article_to_topic.state', 0) + ->count(); //获取作者 foreach ($list as $k => $v) { $stage_info = $this->journal_stage_obj->where('journal_stage_id',$v['journal_stage_id'])->find(); @@ -156,6 +164,7 @@ class Article extends Controller { } $re['topicInfo'] = $topic_info; $re['articleList'] = $list; + $re['count'] = $count; return jsonSuccess($re); } private function getAuthor($article) { @@ -261,6 +270,7 @@ class Article extends Controller { */ public function getTopArt() { $data = $this->request->post(); + $journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find(); $list = []; if ($data['type'] == 'cited') { $list = $this->article_obj->field('j_article.*,j_journal_stage.*') @@ -284,6 +294,16 @@ class Article extends Controller { ->orderRaw('j_article.html_num+j_article.pdf_num desc') ->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'] . '. ' . $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); + } + //标题斜体 foreach ($list as $k => $v) { $caches = $this->article_ltai_obj->where('article_id', $v['article_id'])->where('state', 0)->column('content'); @@ -394,7 +414,6 @@ class Article extends Controller { $ris .= 'JF - '.$journal['title']."\n"; $kws = explode(', ', $article_info['keywords']); foreach ($kws as $vvv){ - $ris .= 'KW - '.str_replace('','',str_replace('','',$vvv))."\n"; } $abs = str_replace('Abstract','',strip_tags(str_replace(" ","",htmlspecialchars_decode($article_info['abstract'])))); diff --git a/application/api/controller/Journal.php b/application/api/controller/Journal.php index 5f20a43..b3269ba 100644 --- a/application/api/controller/Journal.php +++ b/application/api/controller/Journal.php @@ -134,17 +134,26 @@ class Journal extends Controller { */ 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(); + $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(); //处理数组 - $frag = []; - foreach ($res as $v) { - if ($v['parent_id'] == 0) { - $frag[] = $v; - } - } + $frag = $p_res; +// foreach ($res as $v) { +// if ($v['parent_id'] == 0) { +// $frag[] = $v; +// } +// } foreach ($frag as $kk => $vv) { $frag[$kk] = $this->getChieldarr($vv, $res); } @@ -650,6 +659,7 @@ class Journal extends Controller { $repeat = $this->subscribe_journal_obj ->where('journal_id', $data['journal_id']) ->where('email', $data['email']) + ->where('state',0) ->find(); if ($repeat) { return jsonError('repeat subscribe!'); @@ -691,6 +701,7 @@ class Journal extends Controller { $repeat = $this->subscribe_topic_obj ->where('topic_id', $data['topic_id']) ->where('email', $data['email']) + ->where('state',0) ->find(); if ($repeat) { return jsonError('repeat subscribe!'); diff --git a/application/master/controller/Journal.php b/application/master/controller/Journal.php index c19a894..f6226a2 100644 --- a/application/master/controller/Journal.php +++ b/application/master/controller/Journal.php @@ -21,6 +21,7 @@ class Journal extends Controller { protected $journal_line_obj = ''; protected $journal_notices_obj = ''; protected $journal_abs_obj = ''; + protected $article_author_obj = ''; protected $article_to_topic_obj = ''; protected $article_to_line_obj = ''; protected $journal_cfp_obj = ''; @@ -39,6 +40,7 @@ class Journal extends Controller { $this->journal_line_obj = Db::name('journal_line'); $this->journal_notices_obj = Db::name('journal_notices'); $this->journal_abs_obj = Db::name('journal_abstracting'); + $this->article_author_obj = Db::name('article_author'); $this->article_to_topic_obj = Db::name('article_to_topic'); $this->article_to_line_obj = Db::name('article_to_line'); $this->journal_cfp_obj = Db::name('journal_cfp'); @@ -762,6 +764,10 @@ class Journal extends Controller { } } + public function myttt(){ + $this->msg_subscript_journal(5, 1); + } + private function msg_subscript_journal($journal_stage_id,$journal_id){ $articles = $this->article_obj->where('journal_stage_id',$journal_stage_id)->where('state',0)->select(); $stage_info = $this->journal_stage_obj->where('journal_stage_id', $journal_stage_id)->find(); @@ -769,19 +775,36 @@ class Journal extends Controller { $list = $this->subscribe_journal_obj->where('journal_id',$journal_id)->where('state',0)->select(); //组成文章信息 - $tt1 = $journal_info['title'].'

'; - $tt1 .= 'The following new articles have just been published in '.$journal_info['title'].'

'; + $tt1 = '
+
+
+ +


'; + $tt1 .= $journal_info['title'].'

'; + $tt1 .= 'Dear Researcher,
'; + $tt1 .= 'It is our great honor to present you the articles published in '.$journal_info['title'].'.
'; + $tt1 .= 'The following new articles have just been published.

'; foreach ($articles as $val){ $tt1 .= $val['type'].'
'; - $tt1 .= $val['title'].'
'; + $tt1 .= ''.$val['title'].'
'; $tt1 .= $this->getAuthor($val).'
'; - $tt1 .= $journal_info['title'].' '.$stage_info['stage_year'].' '.$stage_info['stage_vol']."(".$stage_info['stage_no']."). https://doi.org/".$val['doi'].'


'; + $tt1 .= $journal_info['title'].' '.$stage_info['stage_year'].' '.$stage_info['stage_vol']."(".$stage_info['stage_no']."). DOI:".$val['doi'].'
'; + $tt1 .= 'Download pdf


'; } - $tt2 = 'TMR Publishing Group Ltd.
'; + $tt2 = 'Email: '.$journal_info['email'].'
'; + $tt2 .= 'Website: https://www.tmrjournals.com/'.$journal_info['usx'].'

'; + $tt2 .= 'TMR Publishing Group Ltd.
'; $tt2 .= '11 Cockle Bay Rd, Cockle Bay, Auckland, New Zealand
'; - $tt2 .= 'Tel: +64 02108293806.
'; - $tt2 .= 'Email: '.$journal_info['email'].'
'; - $tt2 .= 'Web: https://www.tmrjournals.com/'.$journal_info['usx']; + $tt2 .= 'Tel: +64 02108293806.'; + $tt2 .= '
+
'; foreach ($list as $v){ $cache = $tt1.'Unsubscribe

'.$tt2; @@ -791,6 +814,7 @@ class Journal extends Controller { $maidata['tmail'] = 'publicrelations@tmrjournals.com'; $maidata['tpassword'] = 'pRWU999999'; Queue::push('app\api\job\mail@fire', $maidata, "mail"); + echo $v['email']; } } private function getAuthor($article) {