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']).",
";
$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/).
';
$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.
";
$content .= "If you plan to contribute, please kindly send us a short abstract via e-mail in advance.
";
$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.
";
$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.
";
$content .= "You may find more information about the journal, including the editorial board and Special Issues, at https://www.tmrjournals.com/bmec/
";
$content .= "If you have any questions, please feel free to contact me.
We look forward to hearing from you.
Best regards,
Aubree zhu
Journal Editor
WeChat: 15620305727
";
$content .= "Recruiting reviewers
https://submission.tmrjournals.com/reviewer
Biomedical Engineering Communications
Email: bmec@tmrjournals.com
Website: https://www.tmrjournals.com/bmec/
";
$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 "
"; //var_dump($a); //echo ""; //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']).",