This commit is contained in:
wangjinlei
2021-02-09 11:29:19 +08:00
parent d12cd7266e
commit 9c68dd26c1
4 changed files with 130 additions and 2 deletions

View File

@@ -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,<br><br>';
$tt .= 'Welcome you to the email alert for the latest research and more. Thank you for your interest in our publications and topics.<br>';
$tt .= '<a href="http://journalapi.tmrjournals.com/public/index.php/api/Journal/UnsubscribeJournal/snum/'.$id.'">Unsubscribe</a><br>';
$tt .= 'This service is provided by TMR Publishing Group | New Zealand<br>';
$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,<br><br>';
$tt .= 'Welcome you to the email alert for the latest research and more. Thank you for your interest in our publications and topics.<br>';
$tt .= '<a href="http://journalapi.tmrjournals.com/public/index.php/api/Journal/UnsubscribeTopic/snum/'.$id.'">Unsubscribe</a><br>';
$tt .= 'This service is provided by TMR Publishing Group | New Zealand<br>';
$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;

View File

@@ -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);
}
}

View File

@@ -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 增加期刊消息

View File

@@ -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([]);
}
}