邮件修改

This commit is contained in:
wangzhaocui
2022-03-30 13:55:14 +08:00
parent 0c94687d56
commit b2bde69f8f
9 changed files with 503 additions and 151 deletions

View File

@@ -6,6 +6,7 @@ use think\Controller;
use think\Db;
use think\captcha;
use think\Cache;
use think\Env;
use think\Queue;
/**
@@ -265,9 +266,21 @@ class User extends Controller {
$insert_data['ctime'] = time();
$res = $this->user_reviewer_obj->insertGetId($insert_data);
//发送email-》编辑
$tt = 'Dear editor,<br>';
$tt .= 'Please check the new reviewer application.';
sendEmail($editor_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
$sendEditor=[
'title'=>$journal_info['title'], // 邮件标题
'content'=>'Dear editor,<br> Please check the new reviewer application.',//邮件内容
'user_id'=>$journal_info['editor_id'], //收件人ID
'email'=>$editor_info['email'],// 收件人邮箱
'journal_id'=>$journal_info['journal_id'], // 期刊ID
'sendEmail'=>$journal_info['email'], // 期刊邮箱
'sendPassword'=>$journal_info['epassword'], // 期刊密码
'from_name'=>$journal_info['title']
];
Queue::push('app\api\job\domail@fire',$sendEditor,'domail');
// $tt = 'Dear editor,<br>';
// $tt .= 'Please check the new reviewer application.';
// sendEmail($editor_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
//发送消息信息--编辑
add_usermsg($journal_info['editor_id'], '新增审稿人申请,申请人(' . $data['username'] . ')', '/reviewerApplyDetail?id=' . $res);
@@ -437,14 +450,25 @@ class User extends Controller {
$inser_data['phone'] = $data['phone'];
$inser_data['realname'] = $data['name'];
$inser_data['ctime'] = time();
$this->user_obj->insert($inser_data);
$id = $this->user_obj->insertGetId($inser_data);
//发送注册成功邮件
$tt = 'Hello,<br><br>';
$tt .= 'Your account has been created. You may check on the status of your manuscript using this submission and tracking system: https://submission.tmrjournals.com<br>';
$tt .= "Username:$account<br>";
$tt .= "Password:" . $data['password'] . '<br><br>';
$tt .= "Many thanks<br>TMR Publishing Group";
sendEmail($email, 'Dear ' . $data['name'], 'TMR', $tt);
// sendEmail($email, 'Dear ' . $data['name'], 'TMR', $tt);
$sendUser=[
'title'=>'Dear ' . $data['name'], // 邮件标题
'content'=>$tt,//邮件内容
'user_id'=>$id, //收件人ID
'email'=>$email,// 收件人邮箱
'journal_id'=>0, // 期刊ID
'sendEmail'=>Env::get('email.send_email'), // 期刊邮箱
'sendPassword'=>Env::get('email.send_email_password'), // 期刊密码
'from_name'=>'TMR'
];
Queue::push('app\api\job\domail@fire',$sendUser,'domail');
return json($inser_data);
}
@@ -512,7 +536,8 @@ class User extends Controller {
public function retrievePushEmail() {
$email = $this->request->post('email');
$where['email'] = $email;
$realname = $this->user_obj->where($where)->value('realname');
$user = $this->user_obj->where($where)->field('realname,user_id')->find();
$realname = $user['realname'];
//插入数据库隐形操作表数据
$act_insert['act_key'] = authcode($email . time());
$act_insert['type'] = 'retrieve';
@@ -523,11 +548,22 @@ class User extends Controller {
$url = config('base_web_url') . 'retrieveact?actkey=' . $act_insert['act_key'];
$title = 'Your request to reset your password [TMR Publishing Group]';
$content = "$realname, we've received your request to reset your password.Please click the link below to change your password. <a href='$url' target='_blank'>$url</a>";
$res = sendEmail($email, $title, 'TMR', $content);
if ($res['status'] == 1) {//成功
//$res = sendEmail($email, $title, 'TMR', $content);
$sendUser=[
'title'=>$title, // 邮件标题
'content'=>$content,//邮件内容
'user_id'=>$user['user_id'], //收件人ID
'email'=>$email,// 收件人邮箱
'journal_id'=>0, // 期刊ID
'sendEmail'=>Env::get('email.send_email'), // 期刊邮箱
'sendPassword'=>Env::get('email.send_email_password'), // 期刊密码
'from_name'=>'TMR'
];
$isUserPushed = Queue::push('app\api\job\domail@fire',$sendUser,'domail');
if ($isUserPushed) {//成功
return json(['code' => 0, 'msg' => 'success']);
} else {//失败
return json(['code' => 1, 'msg' => $res['data']]);
return json(['code' => 1, 'msg' => 'fail']);
}
}
@@ -887,7 +923,18 @@ class User extends Controller {
$content .= '<a href="https://submission.tmrjournals.com">SubmissionSystem</a><br>';
$content .= '<p>username:' . $apply_info['name'] . '</p>';
$content .= '<p>Original Password: 123456qwe</p>'; //$has_res ? '' : '<p>password:123456qwe</p>';
sendEmail($apply_info['email'], $journal_info['title'], $journal_info['title'], $content, $journal_info['email'], $journal_info['epassword']);
$sendUser=[
'title'=> $journal_info['title'], // 邮件标题
'content'=>$content,//邮件内容
'user_id'=>$has_res['user_id'], //收件人ID
'email'=>$apply_info['email'],// 收件人邮箱
'journal_id'=>$journal_info['journal_id'], // 期刊ID
'sendEmail'=>$journal_info['email'], // 期刊邮箱
'sendPassword'=>$journal_info['epassword'], // 期刊密码
'from_name'=>$journal_info['title']
];
Queue::push('app\api\job\domail@fire',$sendUser,'domail');
//sendEmail($apply_info['email'], $journal_info['title'], $journal_info['title'], $content, $journal_info['email'], $journal_info['epassword']);
$update_res = $this->user_reviewer_obj->where($where)->update(['state' => 1]);
if ($res && $add_res && $addinfo_res && $update_res) {
Db::commit();