1
This commit is contained in:
@@ -7,7 +7,8 @@ use think\Db;
|
||||
use think\Queue;
|
||||
use think\Validate;
|
||||
|
||||
class Email extends Controller{
|
||||
class Email extends Controller
|
||||
{
|
||||
|
||||
protected $article_obj = '';
|
||||
protected $user_obj = '';
|
||||
@@ -36,7 +37,8 @@ class Email extends Controller{
|
||||
protected $email_log_obj = '';
|
||||
protected $email_template_obj = '';
|
||||
|
||||
public function __construct(\think\Request $request = null) {
|
||||
public function __construct(\think\Request $request = null)
|
||||
{
|
||||
parent::__construct($request);
|
||||
$this->user_obj = Db::name('user');
|
||||
$this->user_act_obj = Db::name('user_act');
|
||||
@@ -67,23 +69,22 @@ class Email extends Controller{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 添加邮件模板
|
||||
*/
|
||||
public function addEmailTemplate(){
|
||||
public function addEmailTemplate()
|
||||
{
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'etitle'=>'require',
|
||||
'epid'=>'require',
|
||||
'etitle' => 'require',
|
||||
'epid' => 'require',
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$insert['etitle'] = $data['etitle'];
|
||||
$insert['epid'] = $data['epid'];
|
||||
$insert['econtent'] = isset($data['econtent'])?$data['econtent']:'';
|
||||
$insert['econtent'] = isset($data['econtent']) ? $data['econtent'] : '';
|
||||
$this->email_template_obj->insert($insert);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
@@ -91,32 +92,34 @@ class Email extends Controller{
|
||||
/**
|
||||
* 删除邮件模板
|
||||
*/
|
||||
public function delEmailTemplate(){
|
||||
public function delEmailTemplate()
|
||||
{
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'eid'=>'require'
|
||||
'eid' => 'require'
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$info = $this->email_template_obj->where('eid',$data['eid'])->find();
|
||||
if($info['epid']==0){
|
||||
$check = $this->email_template_obj->where('epid',$info['eid'])->where('estate',0)->find();
|
||||
if($check){
|
||||
$info = $this->email_template_obj->where('eid', $data['eid'])->find();
|
||||
if ($info['epid'] == 0) {
|
||||
$check = $this->email_template_obj->where('epid', $info['eid'])->where('estate', 0)->find();
|
||||
if ($check) {
|
||||
return jsonError('Please delete all subitems first!');
|
||||
}
|
||||
}
|
||||
$this->email_template_obj->where('eid',$data['eid'])->update(['estate'=>1]);
|
||||
$this->email_template_obj->where('eid', $data['eid'])->update(['estate' => 1]);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全部邮件模板
|
||||
*/
|
||||
public function getAllEmailTemplate(){
|
||||
$list = $this->email_template_obj->where('epid',0)->where('estate',0)->select();
|
||||
foreach($list as $k => $v){
|
||||
$cache = $this->email_template_obj->where('epid',$v['eid'])->where('estate',0)->select();
|
||||
public function getAllEmailTemplate()
|
||||
{
|
||||
$list = $this->email_template_obj->where('epid', 0)->where('estate', 0)->select();
|
||||
foreach ($list as $k => $v) {
|
||||
$cache = $this->email_template_obj->where('epid', $v['eid'])->where('estate', 0)->select();
|
||||
$list[$k]['children'] = $cache;
|
||||
}
|
||||
$re['templates'] = $list;
|
||||
@@ -126,15 +129,16 @@ class Email extends Controller{
|
||||
/**
|
||||
* 获取邮件模板
|
||||
*/
|
||||
public function getEmailTemplate(){
|
||||
public function getEmailTemplate()
|
||||
{
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'eid'=>'require'
|
||||
'eid' => 'require'
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$info = $this->email_template_obj->where('eid',$data['eid'])->where('estate',0)->find();
|
||||
$info = $this->email_template_obj->where('eid', $data['eid'])->where('estate', 0)->find();
|
||||
$re['template'] = $info;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
@@ -142,42 +146,44 @@ class Email extends Controller{
|
||||
/**
|
||||
* 增加模板调用计数
|
||||
*/
|
||||
public function addEmailTemplateNum(){
|
||||
public function addEmailTemplateNum()
|
||||
{
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'eid'=>'require'
|
||||
'eid' => 'require'
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$this->email_template_obj->where('eid',$data['eid'])->setInc('num');
|
||||
$this->email_template_obj->where('eid', $data['eid'])->setInc('num');
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送模板邮件
|
||||
*/
|
||||
public function pushEmailOnTemplate(){
|
||||
public function pushEmailOnTemplate()
|
||||
{
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'email'=>'require',
|
||||
'content'=>'require',
|
||||
'article_id'=>'require'
|
||||
'email' => 'require',
|
||||
'content' => 'require',
|
||||
'article_id' => 'require'
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$article_info = $this->article_obj->where('article_id',$data['article_id'])->find();
|
||||
$journal_info = $this->journal_obj->where('journal_id',$article_info['journal_id'])->find();
|
||||
$article_info = $this->article_obj->where('article_id', $data['article_id'])->find();
|
||||
$journal_info = $this->journal_obj->where('journal_id', $article_info['journal_id'])->find();
|
||||
|
||||
|
||||
|
||||
$maidata['email'] = $data['email'];
|
||||
$maidata['title'] = $journal_info['title'];
|
||||
$maidata['content'] = $data['content'];
|
||||
$maidata['tmail'] = $journal_info['email'];
|
||||
$maidata['tpassword'] = $journal_info['epassword'];
|
||||
$maidata['article_id'] = $data['article_id'];
|
||||
$maidata['attachmentFile'] = (isset($data['attachment'])&&$data['attachment']!='')?ROOT_PATH . 'public' . DS . $data['attachment']:'';
|
||||
$maidata['attachmentFile'] = (isset($data['attachment']) && $data['attachment'] != '') ? ROOT_PATH . 'public' . DS . $data['attachment'] : '';
|
||||
|
||||
Queue::push('app\api\job\mail@tgpu', $maidata, "tmail");
|
||||
|
||||
@@ -186,39 +192,48 @@ class Email extends Controller{
|
||||
}
|
||||
|
||||
|
||||
public function lsPushEmail()
|
||||
{
|
||||
// $journal_info = $this->journal_obj->where("journal_id", 4)->find();
|
||||
// $list[] = "751475802@qq.com";
|
||||
// $list[] = "15122276210@163.com";
|
||||
|
||||
public function lsPushEmail(){
|
||||
$journal_info = $this->journal_obj->where("journal_id",1)->find();
|
||||
$list[] = "751475802@qq.com";
|
||||
$list[] = "17627882183@163.com";
|
||||
// $list = $this->user_obj->where("state",0)->select();
|
||||
// echo "<pre>";
|
||||
// var_dump($list);
|
||||
// echo "</pre>";
|
||||
// die;
|
||||
$tt = "Dear <br/>
|
||||
Hope this email finds you well.<br/>
|
||||
We have good news to share with you: On May 15, 2024, Traditional Medicine Research received notification from the Scopus Review Committee: the journal has passed the rigorous review of the Scopus Content Selection & Advisory Board (CSAB) and has been officially indexed in the Scopus database! The review highly praised the academic quality of the journal’s articles and our significant progress over the years. This inclusion signifies international recognition of Traditional Medicine Research in terms of academic level and publishing quality, which is crucial for enhancing the journal’s international impact.<br/>
|
||||
As of now, the databases that index Traditional Medicine Research include: ESCI, Scopus, ROAD, Embase, ScienceGate, ProQuest, Google Scholar, and so on.<br/>
|
||||
For more details about the journal, please click on the official website link below:<br/>
|
||||
https://www.tmrjournals.com/tmr/<br/><br/>
|
||||
$list = Db::name("reviewer_to_journal t")
|
||||
->join("t_user u", "u.user_id = t.reviewer_id", "left")
|
||||
->field("t.*,u.email,u.realname")
|
||||
->where("t.journal_id", 4)
|
||||
->where("t.state", 0)
|
||||
->where("not exists(select * from t_reviewer_to_journal where journal_id=22 and state = 0 and reviewer_id = t.reviewer_id)")
|
||||
->select();
|
||||
foreach ($list as $v) {
|
||||
$tt = "Dear " . $v['realname'] == "" ? $v['account'] : $v['realname'] . ",<br/><br/>";
|
||||
$tt .= "
|
||||
I hope this message finds you well.<br/><br/>
|
||||
|
||||
I am writing to inform you about a significant change in our journal structure. Due to substantial overlap in scope, our publisher has decided to merge Toxicology Advances (TA) into Pharmacology Discovery (PD).<br/><br/>
|
||||
|
||||
As part of this transition, the editorial board has decided to transfer all reviewers from TA to PD. We highly value your contributions and hope that you will continue to lend your expertise to PD. <br/><br/>
|
||||
|
||||
If you agree to serve as a reviewer for PD, please click on the following link. The system will automatically add you to the PD reviewer system: <br/><a href='http://api.tmrjournals.com/public/index.php/api/Reviewer/changeJournalReviewerForPD?userId=" . $v['reviewer_id'] . "'>[Insert link here]</a><br/><br/>
|
||||
|
||||
However, if you prefer not to continue as a reviewer for PD, please disregard this email.<br/><br/>
|
||||
|
||||
Thank you for your understanding and continued support.<br/><br/>
|
||||
|
||||
Best regards,<br/>
|
||||
|
||||
Best regards.<br/>
|
||||
Editorial Office<br/>
|
||||
Traditional Medicine Research";
|
||||
foreach ($list as $v){
|
||||
Toxicology Advances";
|
||||
// $maidata['email'] = $v['email'];
|
||||
$maidata['email'] = $v;
|
||||
$maidata['title'] = "Great news! Traditional Medicine Research has been formally indexed in the Scopus database";
|
||||
$maidata['email'] = $v['email'];
|
||||
$maidata['title'] = "Toxicology Advances: Reviewer Transition";
|
||||
$maidata['content'] = $tt;
|
||||
$maidata['has_hb'] = 1;
|
||||
// $maidata['tmail'] = $journal_info['email'];
|
||||
// $maidata['tpassword'] = $journal_info['epassword'];
|
||||
aliemail($maidata['email'],$maidata['title'],$maidata['content'],$maidata['has_hb']);
|
||||
// Queue::push('app\api\job\mail@promotion', $maidata, "tmail");
|
||||
|
||||
// aliemail($maidata['email'],$maidata['title'],$maidata['content'],$maidata['has_hb']);
|
||||
Queue::push('app\api\job\mail@promotion', $maidata, "tmail");
|
||||
}
|
||||
|
||||
echo "ok";
|
||||
|
||||
}
|
||||
@@ -227,15 +242,16 @@ Traditional Medicine Research";
|
||||
/**
|
||||
* 获取邮件发送记录通过文章
|
||||
*/
|
||||
public function getEmailsByArticle(){
|
||||
public function getEmailsByArticle()
|
||||
{
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'article_id'=>'require'
|
||||
'article_id' => 'require'
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$list = $this->email_log_obj->where('article_id',$data['article_id'])->where('is_success',1)->select();
|
||||
$list = $this->email_log_obj->where('article_id', $data['article_id'])->where('is_success', 1)->select();
|
||||
$re['emails'] = $list;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
@@ -244,7 +260,8 @@ Traditional Medicine Research";
|
||||
/**
|
||||
* 上传文章的文件
|
||||
*/
|
||||
public function up_enclosure_file() {
|
||||
public function up_enclosure_file()
|
||||
{
|
||||
$file = request()->file("enclosure");
|
||||
if ($file) {
|
||||
$info = $file->move(ROOT_PATH . 'public' . DS . 'enclosure');
|
||||
|
||||
Reference in New Issue
Block a user