420 lines
17 KiB
PHP
420 lines
17 KiB
PHP
<?php
|
|
|
|
namespace app\api\controller;
|
|
|
|
use think\Controller;
|
|
use app\api\controller\Base;
|
|
use think\Db;
|
|
use think\Queue;
|
|
use think\Env;
|
|
use think\Validate;
|
|
|
|
class Email extends Base
|
|
{
|
|
|
|
|
|
public function __construct(\think\Request $request = null)
|
|
{
|
|
parent::__construct($request);
|
|
}
|
|
|
|
|
|
/**
|
|
* 添加邮件模板
|
|
*/
|
|
public function addEmailTemplate()
|
|
{
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
'etitle' => 'require',
|
|
'epid' => 'require',
|
|
]);
|
|
if (!$rule->check($data)) {
|
|
return jsonError($rule->getError());
|
|
}
|
|
$insert['etitle'] = $data['etitle'];
|
|
$insert['epid'] = $data['epid'];
|
|
$insert['econtent'] = isset($data['econtent']) ? $data['econtent'] : '';
|
|
$this->email_template_obj->insert($insert);
|
|
return jsonSuccess([]);
|
|
}
|
|
|
|
/**
|
|
* 删除邮件模板
|
|
*/
|
|
public function delEmailTemplate()
|
|
{
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
'eid' => 'require'
|
|
]);
|
|
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) {
|
|
return jsonError('Please delete all subitems first!');
|
|
}
|
|
}
|
|
$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();
|
|
$list[$k]['children'] = $cache;
|
|
}
|
|
$re['templates'] = $list;
|
|
return jsonSuccess($re);
|
|
}
|
|
|
|
/**
|
|
* 获取邮件模板
|
|
*/
|
|
public function getEmailTemplate()
|
|
{
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
'eid' => 'require'
|
|
]);
|
|
if (!$rule->check($data)) {
|
|
return jsonError($rule->getError());
|
|
}
|
|
$info = $this->email_template_obj->where('eid', $data['eid'])->where('estate', 0)->find();
|
|
$re['template'] = $info;
|
|
return jsonSuccess($re);
|
|
}
|
|
|
|
/**
|
|
* 增加模板调用计数
|
|
*/
|
|
public function addEmailTemplateNum()
|
|
{
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
'eid' => 'require'
|
|
]);
|
|
if (!$rule->check($data)) {
|
|
return jsonError($rule->getError());
|
|
}
|
|
$this->email_template_obj->where('eid', $data['eid'])->setInc('num');
|
|
return jsonSuccess([]);
|
|
}
|
|
|
|
/**
|
|
* 发送模板邮件
|
|
*/
|
|
public function pushEmailOnTemplate()
|
|
{
|
|
|
|
die();
|
|
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
'email' => 'require',
|
|
'content' => 'require',
|
|
'article_id' => 'require'
|
|
]);
|
|
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();
|
|
|
|
|
|
$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'] : '';
|
|
|
|
Queue::push('app\api\job\mail@tgpu', $maidata, "tmail");
|
|
|
|
return jsonSuccess([]);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function pushEmailForBMEC(){
|
|
// $a = readExcel("/home/wwwroot/api.tmrjournals.com/public/system/1.xlsx");
|
|
// $a = readExcel("D:/1.xlsx");
|
|
|
|
$a[] = ["wangjinlei","testtesttest","13662001490@126.com"];
|
|
$a[] = ["wangjinlei1","testtesttest1","751475802@qq.com"];
|
|
|
|
|
|
|
|
$journal_info = $this->journal_obj->where("journal_id",23)->find();
|
|
// $email = "1300364247@qq.com";
|
|
// $email = "751475802@qq.com";
|
|
|
|
foreach ($a as $k=>$v){
|
|
$content = "Dear Dr. ".trim($v['0']).",<br/><br/>";
|
|
$content .= 'We recently read your article "'.trim($v[1]).'", and we consider your research interests and expertise to be aligned well with the scope of the journal Biomedical Engineering Communications(https://www.tmrjournals.com/bmec/).<br/><br/>';
|
|
$content .= "Thus, on behalf of the editorial team of BMEC, we would like to invite you to publish a feature paper in BMEC, and please note that standard article processing charge of 0 CHF.<br/><br/>";
|
|
$content .= "If you plan to contribute, please kindly send us a short abstract via e-mail in advance.<br/><br/>";
|
|
$content .= "Biomedical Engineering Communications (ISSN: 2815-9063) is a peer-reviewed, open-access journal managed by TMR Publishing Group. Biomedical engineering is an interdisciplinary discipline that combines the principles of physics, chemistry, mathematics, computer and engineering, to study biomedicine and develop innovative biological products, materials, processing methods, implants, devices and informatics.<br/><br/>";
|
|
$content .= "The aim of Biomedical Engineering Communications is to promote the integration of new technologies, new ideas, new methods and life sciences in the field of engineering, and to enhance the digitization, automation and intelligence of biomedical engineering technology.<br/><br/>";
|
|
$content .= "You may find more information about the journal, including the editorial board and Special Issues, at https://www.tmrjournals.com/bmec/<br/><br/>";
|
|
$content .= "If you have any questions, please feel free to contact me.<br/><br/>We look forward to hearing from you.<br/>Best regards,<br/>Aubree zhu<br/>Journal Editor<br/>WeChat: 15620305727<br/><br/>";
|
|
$content .= "Recruiting reviewers<br/>https://submission.tmrjournals.com/reviewer<br/><br/>Biomedical Engineering Communications<br/>Email: bmec@tmrjournals.com<br/>Website: https://www.tmrjournals.com/bmec/<br/>";
|
|
$pre = Env::get('emailtemplete.pre');
|
|
$net = Env::get('emailtemplete.net');
|
|
$net1 = str_replace("{{email}}",trim($v[2]),$net);
|
|
$mailbody=$pre.$content.$net1;
|
|
|
|
$edata['email'] = trim($v[2]);
|
|
$edata['title'] = "[Biomedical Engineering Communications] Invitation for More Cooperation Without Free";
|
|
$edata['content'] = $mailbody;
|
|
$edata['tmail'] = $journal_info['email'];
|
|
$edata['tpassword'] = $journal_info['epassword'];
|
|
Queue::push('app\api\job\mail@fire', $edata, "tmail");
|
|
}
|
|
|
|
}
|
|
|
|
|
|
public function pushEmailForBMEC1(){
|
|
$a = readExcel("/home/wwwroot/api.tmrjournals.com/public/system/2.xlsx");
|
|
|
|
$a[] = ["wangjinlei","testtesttest","13662001490@126.com"];
|
|
// $a[] = ["wangjinlei1","testtesttest1","751475802@qq.com"];
|
|
// $a[] = ["Aubree Zhu","testtesttest2","1300364247@qq.com"];
|
|
|
|
//echo "<pre>";
|
|
//var_dump($a);
|
|
//echo "</pre>";
|
|
//die;
|
|
|
|
$journal_info = $this->journal_obj->where("journal_id",23)->find();
|
|
// $email = "1300364247@qq.com";
|
|
// $email = "751475802@qq.com";
|
|
|
|
foreach ($a as $k=>$v){
|
|
$content = "Dear Dr. ".trim($v['0']).",<br/><br/>";
|
|
$content .= 'We recently read your article "'.trim($v[1]).'", and we consider your research interests and expertise to be aligned well with the scope of the journal Biomedical Engineering Communications(https://www.tmrjournals.com/bmec/).<br/><br/>';
|
|
$content .= "Thus, on behalf of the editorial team of BMEC, we would like to invite you to publish a feature paper in BMEC, and please note that standard article processing charge of 0 CHF.<br/><br/>";
|
|
$content .= "If you plan to contribute, please kindly send us a short abstract via e-mail in advance.<br/><br/>";
|
|
$content .= "Biomedical Engineering Communications (ISSN: 2815-9063) is a peer-reviewed, open-access journal managed by TMR Publishing Group. Biomedical engineering is an interdisciplinary discipline that combines the principles of physics, chemistry, mathematics, computer and engineering, to study biomedicine and develop innovative biological products, materials, processing methods, implants, devices and informatics.<br/><br/>";
|
|
$content .= "The aim of Biomedical Engineering Communications is to promote the integration of new technologies, new ideas, new methods and life sciences in the field of engineering, and to enhance the digitization, automation and intelligence of biomedical engineering technology.<br/><br/>";
|
|
$content .= "You may find more information about the journal, including the editorial board and Special Issues, at https://www.tmrjournals.com/bmec/<br/><br/>";
|
|
$content .= "If you have any questions, please feel free to contact me.<br/><br/>We look forward to hearing from you.<br/>Best regards,<br/>Aubree zhu<br/>Journal Editor<br/>WeChat: 15620305727<br/><br/>";
|
|
$content .= "Recruiting reviewers<br/>https://submission.tmrjournals.com/reviewer<br/><br/>Biomedical Engineering Communications<br/>Email: bmec@tmrjournals.com<br/>Website: https://www.tmrjournals.com/bmec/<br/>";
|
|
$pre = Env::get('emailtemplete.pre');
|
|
$net = Env::get('emailtemplete.net');
|
|
$net1 = str_replace("{{email}}",trim($v[2]),$net);
|
|
$mailbody=$pre.$content.$net1;
|
|
|
|
$edata['email'] = trim($v[2]);
|
|
$edata['title'] = "[Biomedical Engineering Communications] Invitation for More Academic Cooperation";
|
|
$edata['content'] = $mailbody;
|
|
$edata['tmail'] = $journal_info['email'];
|
|
$edata['tpassword'] = $journal_info['epassword'];
|
|
Queue::push('app\api\job\mail@fire', $edata, "tmail");
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function myPush(){
|
|
// phpinfo();die;
|
|
// $data = $this->request->post();
|
|
// $rule = new Validate([
|
|
// "email"=>"require",
|
|
// "title"=>"require",
|
|
// "content"=>"require"
|
|
// ]);
|
|
// if(!$rule->check($data)){
|
|
// return jsonError($rule->getError());
|
|
// }
|
|
|
|
$data['email'] = "751475802@qq.com";
|
|
$data['title'] = "test title";
|
|
$data['content'] = "content";
|
|
|
|
|
|
echo sendMyEmail($data['email'],$data['title'],$data['content']);
|
|
}
|
|
|
|
|
|
|
|
|
|
public function ntaPushEmail(){
|
|
$journal_info = $this->journal_obj->where("journal_id",16)->find();
|
|
// $ids = $this->board_to_journal_obj->where("journal_id",16)->where("state",0)->column("user_id");
|
|
// $ids = $this->user_to_yboard_obj->where("journal_id",16)->where("end_date",">",1747380505)->column("user_id");
|
|
$ids = $this->reviewer_to_journal_obj->where("journal_id",16)->where("state",0)->column("reviewer_id");
|
|
|
|
|
|
$list = $this->user_obj->whereIn("user_id",$ids)->select();
|
|
|
|
// $list[] = "751475802@qq.com";
|
|
// $list[] = "924627193@qq.com";
|
|
|
|
|
|
|
|
foreach ($list as $v){
|
|
|
|
$content = "Dear Dr. ".$v['realname'].",<br/><br/>";
|
|
$content .= "We hereby inform you that Natural Therapy Advances will be merged into Integrative Medicine Discovery as of 19th May, 2025. We sincerely appreciate your long-term support and contributions for Natural Therapy Advances. If you are willing to continue serving as a Young Editorial Board Member/Editorial Board Member/Reviewer for the merged journal Integrative Medicine Discovery, please kindly confirm by replying to this email.<br/><br/>";
|
|
$content .= "Thank you for your consideration.<br/>";
|
|
$content .= "Look forward for your reply.<br/><br/>";
|
|
$content .= "Sincerely,<br/>Editorial Office<br/>Natural Therapy Advances<br/>Email: nta@tmrjournals.com<br/>Website: https://www.tmrjournals.com/nta/<br/>";
|
|
|
|
$pre = Env::get('emailtemplete.pre');
|
|
$net = Env::get('emailtemplete.net');
|
|
$net1 = str_replace("{{email}}",$v['email'],$net);
|
|
$mailbody=$pre.$content.$net1;
|
|
$edata['email'] = $v['email'];
|
|
$edata['title'] = "Notice: Merger of Natural Therapy Advances into Integrative Medicine Discovery";
|
|
$edata['content'] = $mailbody;
|
|
$edata['tmail'] = $journal_info['email'];
|
|
$edata['tpassword'] = $journal_info['epassword'];
|
|
// Queue::push('app\api\job\mail@fire', $edata, "tmail");
|
|
}
|
|
|
|
return jsonSuccess($list);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function getEmailAccounts(){
|
|
$list = $this->email_account_obj->where("state",0)->select();
|
|
$re['list'] = $list;
|
|
|
|
return jsonSuccess($re);
|
|
}
|
|
|
|
public function addEmailAccount(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
"user"=>"require",
|
|
"password"=>"require"
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
$entity["user"] = trim($data['user']);
|
|
$entity['password'] = md5($data['password']);
|
|
$entity['domain'] = "tmrjournals.com.cn";
|
|
$entity['email'] = trim($data['user'])."@tmrjournals.com.cn";
|
|
$entity['home'] = "/var/mail/tmrjournals.com.cn/".$data['user']."/";
|
|
$this->email_account_obj->insert($entity);
|
|
return jsonSuccess([]);
|
|
}
|
|
|
|
|
|
public function changePassword(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
"id"=>"require",
|
|
"password"=>"require"
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
$this->email_account_obj->where("id",$data['id'])->update(['password'=>md5($data['password'])]);
|
|
return jsonSuccess([]);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function lsPushEmail()
|
|
{
|
|
// $journal_info = $this->journal_obj->where("journal_id", 4)->find();
|
|
// $list[] = "751475802@qq.com";
|
|
// $list[] = "15122276210@163.com";
|
|
|
|
$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/>
|
|
|
|
Editorial Office<br/>
|
|
Toxicology Advances";
|
|
// $maidata['email'] = $v['email'];
|
|
$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");
|
|
}
|
|
echo "ok";
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* 获取邮件发送记录通过文章
|
|
*/
|
|
public function getEmailsByArticle()
|
|
{
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
'article_id' => 'require'
|
|
]);
|
|
if (!$rule->check($data)) {
|
|
return jsonError($rule->getError());
|
|
}
|
|
$list = $this->email_log_obj->where('article_id', $data['article_id'])->where('is_success', 1)->select();
|
|
$re['emails'] = $list;
|
|
return jsonSuccess($re);
|
|
}
|
|
|
|
|
|
/**
|
|
* 上传文章的文件
|
|
*/
|
|
public function up_enclosure_file()
|
|
{
|
|
$file = request()->file("enclosure");
|
|
if ($file) {
|
|
$info = $file->move(ROOT_PATH . 'public' . DS . 'enclosure');
|
|
if ($info) {
|
|
return json(['code' => 0, 'upurl' => str_replace("\\", "/", $info->getSaveName())]);
|
|
} else {
|
|
return json(['code' => 1, 'msg' => $file->getError()]);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
} |