This commit is contained in:
wangjinlei
2021-02-09 14:49:29 +08:00
parent 2fbb314c66
commit 4712826e8b
2 changed files with 84 additions and 4 deletions

View File

@@ -23,6 +23,8 @@ class Article extends Controller {
protected $journal_stage_obj = '';
protected $journal_special_obj = '';
protected $country_obj = '';
protected $subscribe_journal_obj = '';
protected $subscribe_topic_obj = '';
public function __construct(\think\Request $request = null) {
parent::__construct($request);
@@ -38,6 +40,8 @@ class Article extends Controller {
$this->journal_stage_obj = Db::name('journal_stage');
$this->journal_special_obj = Db::name('journal_special');
$this->country_obj = Db::name('country');
$this->subscribe_journal_obj = Db::name('subscribe_journal');
$this->subscribe_topic_obj = Db::name('subscribe_topic');
}
/**
@@ -615,6 +619,47 @@ class Article extends Controller {
}
}
private function msg_subscript_topic($topic_id,$article_id){
$article_info = $this->article_obj->where('article_id',$article_id)->find();
$stage_info = $this->journal_stage_obj->where('journal_stage_id', $article_info['journal_stage_id'])->find();
$topic_info = $this->journal_topic_obj->where('journal_topic_id',$topic_id)->find();
$journal_info = $this->journal_obj->where('journal_id',$article_info['journal_id'])->find();
$list = $this->subscribe_topic_obj->where('topic_id',$topic_id)->where('state',0)->select();
//组成文章信息
$tt1 = $journal_info['title'].'<br><br>';
$tt1 .= 'The following new articles have just been published in Topic "'.$topic_info['title'].'" of '.$journal_info['title'].'<br><br>';
$tt1 .= $article_info['type'].'<br>';
$tt1 .= $article_info['title'].'<br>';
$tt1 .= $this->getAuthor($article_info).'<br>';
$tt1 .= $journal_info['title'].' '.$stage_info['stage_year'].' '.$stage_info['stage_vol']."(".$stage_info['stage_no']."). https://doi.org/".$article_info['doi'].'<br><br><br>';
$tt2 = 'TMR Publishing Group Ltd.<br>';
$tt2 .= '11 Cockle Bay Rd, Cockle Bay, Auckland, New Zealand<br>';
$tt2 .= 'Tel: +64 02108293806.<br>';
$tt2 .= 'Email: '.$journal_info['email'].'<br>';
$tt2 .= 'Web: https://www.tmrjournals.com/'.$journal_info['usx'];
foreach ($list as $v){
$cache = $tt1.'<a href="http://journalapi.tmrjournals.com/public/index.php/api/Journal/UnsubscribeTopic/snum/'.$v['subscribe_topic_id'].'">Unsubscribe</a><br><br>'.$tt2;
$maidata['email'] = $v['email'];
$maidata['title'] = $journal_info['title'];
$maidata['content'] = $cache;
$maidata['tmail'] = 'publicrelations@tmrjournals.com';
$maidata['tpassword'] = 'pRWU999999';
Queue::push('app\api\job\mail@fire', $maidata, "mail");
}
}
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;
}
/**
* @title 删除文章话题
* @description 删除文章话题

View File

@@ -753,7 +753,7 @@ class Journal extends Controller {
$res = $this->journal_stage_obj->update($data);
//是否提醒订阅者
if($old['is_publish']==0&&$data['is_publish']==1){
$this->msg_subscript_journal($old['journal_id']);
$this->msg_subscript_journal($data['journal_stage_id'],$old['journal_id']);
}
if($res){
return json(['code'=>0,'msg'=>'success']);
@@ -762,11 +762,46 @@ class Journal extends Controller {
}
}
private function msg_subscript_journal($journal_id){
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();
$journal_info = $this->journal_obj->where('journal_id',$journal_id)->find();
$list = $this->subscribe_journal_obj->where('journal_id',$journal_id)->where('state',0)->select();
foreach ($list as $v){
//组成文章信息
$tt1 = $journal_info['title'].'<br><br>';
$tt1 .= 'The following new articles have just been published in '.$journal_info['title'].'<br><br>';
foreach ($articles as $val){
$tt1 .= $val['type'].'<br>';
$tt1 .= $val['title'].'<br>';
$tt1 .= $this->getAuthor($val).'<br>';
$tt1 .= $journal_info['title'].' '.$stage_info['stage_year'].' '.$stage_info['stage_vol']."(".$stage_info['stage_no']."). https://doi.org/".$val['doi'].'<br><br><br>';
}
$tt2 = 'TMR Publishing Group Ltd.<br>';
$tt2 .= '11 Cockle Bay Rd, Cockle Bay, Auckland, New Zealand<br>';
$tt2 .= 'Tel: +64 02108293806.<br>';
$tt2 .= 'Email: '.$journal_info['email'].'<br>';
$tt2 .= 'Web: https://www.tmrjournals.com/'.$journal_info['usx'];
foreach ($list as $v){
$cache = $tt1.'<a href="http://journalapi.tmrjournals.com/public/index.php/api/Journal/UnsubscribeJournal/snum/'.$v['subscribe_journal_id'].'">Unsubscribe</a><br><br>'.$tt2;
$maidata['email'] = $v['email'];
$maidata['title'] = $journal_info['title'];
$maidata['content'] = $cache;
$maidata['tmail'] = 'publicrelations@tmrjournals.com';
$maidata['tpassword'] = 'pRWU999999';
Queue::push('app\api\job\mail@fire', $maidata, "mail");
}
}
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;
}
/**