From 9c68dd26c1c3444da4f5dc628be2d92d5a0bf765 Mon Sep 17 00:00:00 2001 From: wangjinlei <751475802@qq.com> Date: Tue, 9 Feb 2021 11:29:19 +0800 Subject: [PATCH] 20201112 --- application/api/controller/Journal.php | 42 ++++++++++++++++++- application/api/controller/Special.php | 22 ++++++++++ application/master/controller/Journal.php | 17 ++++++++ application/master/controller/Special.php | 51 +++++++++++++++++++++++ 4 files changed, 130 insertions(+), 2 deletions(-) diff --git a/application/api/controller/Journal.php b/application/api/controller/Journal.php index b9ba068..5f20a43 100644 --- a/application/api/controller/Journal.php +++ b/application/api/controller/Journal.php @@ -656,7 +656,22 @@ class Journal extends Controller { } $insert['journal_id'] = $data['journal_id']; $insert['email'] = $data['email']; - $this->subscribe_journal_obj->insert($insert); + $id = $this->subscribe_journal_obj->insertGetId($insert); + //发送邮件感谢 + $tt = 'Dear Researcher,

'; + $tt .= 'Welcome you to the email alert for the latest research and more. Thank you for your interest in our publications and topics.
'; + $tt .= 'Unsubscribe
'; + $tt .= 'This service is provided by TMR Publishing Group | New Zealand
'; + $tt .= 'Telephone: +64 02108293806'; + $tt .= 'Email: publisher@tmrjournals.com'; + $tt .= 'www.tmrjournals.com'; + $maidata['email'] = $data['email']; + $maidata['title'] = 'Thank you for subscribing.'; + $maidata['content'] = $tt; + $maidata['tmail'] = 'publicrelations@tmrjournals.com'; + $maidata['tpassword'] = 'pRWU999999'; + Queue::push('app\api\job\mail@fire', $maidata, "mail"); + return jsonSuccess([]); } @@ -682,9 +697,32 @@ class Journal extends Controller { } $insert['topic_id'] = $data['topic_id']; $insert['email'] = $data['email']; - $this->subscribe_topic_obj->insert($insert); + $id = $this->subscribe_topic_obj->insertGetId($insert); + //发送邮件感谢 + $tt = 'Dear Researcher,

'; + $tt .= 'Welcome you to the email alert for the latest research and more. Thank you for your interest in our publications and topics.
'; + $tt .= 'Unsubscribe
'; + $tt .= 'This service is provided by TMR Publishing Group | New Zealand
'; + $tt .= 'Telephone: +64 02108293806'; + $tt .= 'Email: publisher@tmrjournals.com'; + $tt .= 'www.tmrjournals.com'; + $maidata['email'] = $data['email']; + $maidata['title'] = 'Thank you for subscribing.'; + $maidata['content'] = $tt; + $maidata['tmail'] = 'publicrelations@tmrjournals.com'; + $maidata['tpassword'] = 'pRWU999999'; + Queue::push('app\api\job\mail@fire', $maidata, "mail"); return jsonSuccess([]); } + + public function UnsubscribeTopic($snum){ + $this->subscribe_topic_obj->where('subscribe_topic_id',$snum)->update(['state'=>1]); + echo 'Unsubscribe successfully!'; + } + public function UnsubscribeJournal($snum){ + $this->subscribe_journal_obj->where('subscribe_journal_id',$snum)->update(['state'=>1]); + echo 'Unsubscribe successfully!'; + } public function testEmail() { // phpinfo();die; diff --git a/application/api/controller/Special.php b/application/api/controller/Special.php index 3653f6a..88e4adf 100644 --- a/application/api/controller/Special.php +++ b/application/api/controller/Special.php @@ -27,6 +27,7 @@ class Special extends Controller { protected $article_to_topic_obj = ''; protected $sys_scient_obj = ''; protected $sys_book_obj = ''; + protected $journal_special_alert_obj = ''; public function __construct(\think\Request $request = null) { parent::__construct($request); @@ -44,6 +45,7 @@ class Special extends Controller { $this->article_to_topic_obj = Db::name('article_to_topic'); $this->sys_scient_obj = Db::name('system_scient'); $this->sys_book_obj = Db::name('system_books'); + $this->journal_special_alert_obj = Db::name('journal_special_alert'); } /** @@ -292,5 +294,25 @@ class Special extends Controller { } return $frag; } + + /** + * @title 客座期刊(获取客座期刊文章) + * @description 客座期刊(获取客座期刊文章) + * @author wangjinlei + * @url /api/Special/getSpecialArticles + * @method POST + * + * @param name:journal_id type:int require:1 desc:客座期刊id + * + * @return alertInfo:客座期刊提示语# + */ + public function getSpecialAlert(){ + $data = $this->request->post(); + $info = $this->journal_special_alert_obj->where('journal_id',$data['journal_id'])->find(); + + $re['alertInfo'] = $info; + + return jsonSuccess($re); + } } \ No newline at end of file diff --git a/application/master/controller/Journal.php b/application/master/controller/Journal.php index 5b3d33e..09ef636 100644 --- a/application/master/controller/Journal.php +++ b/application/master/controller/Journal.php @@ -4,6 +4,7 @@ namespace app\master\controller; use think\Controller; use think\Db; +use think\Queue; /** * @title 期刊接口 @@ -25,6 +26,8 @@ class Journal extends Controller { protected $journal_cfp_obj = ''; protected $journal_paper_obj = ''; protected $journal_paper_art_obj = ''; + protected $subscribe_journal_obj = ''; + protected $subscribe_topic_obj = ''; public function __construct(\think\Request $request = null) { parent::__construct($request); @@ -41,6 +44,8 @@ class Journal extends Controller { $this->journal_cfp_obj = Db::name('journal_cfp'); $this->journal_paper_obj = Db::name('journal_paper'); $this->journal_paper_art_obj = Db::name('journal_paper_art'); + $this->subscribe_journal_obj = Db::name('subscribe_journal'); + $this->subscribe_topic_obj = Db::name('subscribe_topic'); } /** @@ -744,7 +749,12 @@ class Journal extends Controller { */ public function editStage(){ $data = $this->request->post(); + $old = $this->journal_stage_obj->where('journal_stage_id',$data['journal_stage_id'])->find(); $res = $this->journal_stage_obj->update($data); + //是否提醒订阅者 + if($old['is_publish']==0&&$data['is_publish']==1){ + $this->msg_subscript_journal($old['journal_id']); + } if($res){ return json(['code'=>0,'msg'=>'success']); }else{ @@ -752,6 +762,13 @@ class Journal extends Controller { } } + private function msg_subscript_journal($journal_id){ + $list = $this->subscribe_journal_obj->where('journal_id',$journal_id)->where('state',0)->select(); + foreach ($list as $v){ + + } + } + /** * @title 增加期刊消息 * @description 增加期刊消息 diff --git a/application/master/controller/Special.php b/application/master/controller/Special.php index aeb66c4..dbf73f4 100644 --- a/application/master/controller/Special.php +++ b/application/master/controller/Special.php @@ -24,6 +24,7 @@ class Special extends Controller { protected $journal_special_obj = ''; protected $journal_special_editor_obj = ''; protected $journal_special_to_editor_obj = ''; + protected $journal_special_alert_obj = ''; protected $article_to_topic_obj = ''; protected $sys_scient_obj = ''; protected $sys_book_obj = ''; @@ -41,6 +42,7 @@ class Special extends Controller { $this->journal_special_obj = Db::name('journal_special'); $this->journal_special_editor_obj = Db::name('journal_special_editor'); $this->journal_special_to_editor_obj = Db::name('journal_special_to_editor'); + $this->journal_special_alert_obj = Db::name('journal_special_alert'); $this->article_to_topic_obj = Db::name('article_to_topic'); $this->sys_scient_obj = Db::name('system_scient'); $this->sys_book_obj = Db::name('system_books'); @@ -345,4 +347,53 @@ class Special extends Controller { $this->journal_special_to_editor_obj->where('journal_special_to_editor_id',$data['journal_special_to_editor_id'])->update(['state'=>1]); return jsonSuccess([]); } + + /** + * @title 客座期刊提示语(获取) + * @description 客座期刊提示语(获取) + * @author wangjinlei + * @url /master/Special/getSpecialAlert + * @method POST + * + * @param name:journal_id type:int require:1 desc:期刊id + * + * @return alertInfo:提示语信息# + */ + public function getSpecialAlert(){ + $data = $this->request->post(); + $info = $this->journal_special_alert_obj->where('journal_id',$data['journal_id'])->find(); + if($info==null){ + $insert['journal_id'] = $data['journal_id']; + $insert['agreement'] = ''; + $insert['alert'] = ''; + $insert['intro'] = ''; + $this->journal_special_alert_obj->insert($insert); + } + $d = $this->journal_special_alert_obj->where('journal_id',$data['journal_id'])->find(); + + $re['alertInfo'] = $d; + + return jsonSuccess($re); + } + + /** + * @title 客座期刊提示语(编辑) + * @description 客座期刊提示语(编辑) + * @author wangjinlei + * @url /master/Special/editSpecialAlert + * @method POST + * + * @param name:special_alert_id type:int require:1 desc:客座提示语id + * @param name:agreement type:string require:1 desc:需知 + * @param name:alert type:string require:1 desc:成功提示 + * @param name:intro type:string require:1 desc:投稿简介 + */ + public function editSpecialAlert(){ + $data = $this->request->post(); + $update['agreement'] = $data['agreement']; + $update['alert'] = $data['alert']; + $update['intro'] = $data['intro']; + $this->journal_special_alert_obj->where('special_alert_id',$data['special_alert_id'])->update($update); + return jsonSuccess([]); + } }