This commit is contained in:
wangjinlei
2022-08-23 15:20:37 +08:00
parent 6c759de0fb
commit 29c6b4c627
6 changed files with 200 additions and 31 deletions

73
.env
View File

@@ -40,23 +40,27 @@ pre = '<!doctype html>
<a href="https://www.tmrjournals.com/" target="_blank" style="text-decoration: none">
<img src="https://www.tmrjournals.com/img/tmr.png" width="120"
style="margin: 23px 0 0 30px">
<h3 style="font-size: 12px;color: #214b3c;font-weight: bold;margin: 2px 0 10px 30px;letter-spacing: -0.3px">TMR
<h3 style="font-size: 12px;color: #214b3c;font-weight: bold;margin: 2px 0 10px 30px;letter-spacing: -0.3px">
TMR
Publishing Group</h3>
</a>
</td>
<td width="550" height="100" colspan="1" rowspan="1"
style="font-family: sans-serif; vertical-align: top;font-size: 14px;">
<a href="https://www.tmrjournals.com" target="_blank"
style="color: #333;font-size: 15px;margin: 0 0 0 40px;text-decoration: none;letter-spacing:-0.5px;text-shadow: 0 0 4px #fff;line-height: 95px">Home Page</a>
style="color: #333;font-size: 15px;margin: 0 0 0 40px;text-decoration: none;letter-spacing:-0.5px;text-shadow: 0 0 4px #fff;line-height: 95px">Home
page</a>
<b style="margin: 0 5px;color: #333;">|</b>
<a href="https://www.tmrjournals.com/rev_ver.html" target="_blank"
style="color: #333;font-size: 15px;text-decoration: none;letter-spacing:-0.5px;text-shadow: 0 0 4px #fff">Scientist Community</a>
style="color: #333;font-size: 15px;text-decoration: none;letter-spacing:-0.5px;text-shadow: 0 0 4px #fff">Scientist
Community</a>
<b style="margin: 0 5px;color: #333;">|</b>
<a href="https://www.tmrjournals.com/tmrde/" target="_blank"
style="color: #333;font-size: 15px;text-decoration: none;letter-spacing:-0.5px;text-shadow: 0 0 4px #fff">Database</a>
<b style="margin: 0 5px;color: #333;">|</b>
<a href="https://submission.tmrjournals.com/" target="_blank"
style="color: #333;font-size: 15px;text-decoration: none;letter-spacing:-0.5px;text-shadow: 0 0 4px #fff">Submission System</a>
style="color: #333;font-size: 15px;text-decoration: none;letter-spacing:-0.5px;text-shadow: 0 0 4px #fff">Submission
System</a>
</td>
</tr>
@@ -120,13 +124,14 @@ net = '</p>
<td width="750" height="110" colspan="1" rowspan="1"
style="font-family:sans-serif; vertical-align: top;font-size: 14px;">
<p style="margin: 20px 0 0 30px;line-height: 24px"> Copyright © TMR Publishing Group Limited. <br>
E-Mail: publisher@tmrjournals.com | https://www.tmrjournals.com <br>
Telephone: +64 02108293806</p>
<p style="margin: 32px 0 10px 30px;line-height: 24px">
E-mail: publisher@tmrjournals.com | https://www.tmrjournals.com <br>
Telephone: +64 02108293806
</p>
</td>
<td>
<img src="https://www.tmrjournals.com/img/post_erweim.png"
style="width: 90px;margin: 0 30px 0 0">
style="width: 90px;margin:10px 30px 6px 0">
</td>
</tr>
@@ -135,6 +140,58 @@ net = '</p>
</td>
</tr>
</tbody>
</table>
<table cellpadding="0" cellspacing="0" align="center" width="750"
style="overflow:hidden;margin: 20px auto 0 auto;">
<tbody>
<tr>
<td background="#FFFFFF">
<table cellpadding="0" cellspacing="0" background="#FFFFFF">
<tbody>
<tr style="font-family:sans-serif; vertical-align: top;font-size: 12px;">
<td width="500" height="40" colspan="0" rowspan="0">
<a href="https://www.tmrjournals.com/afoor_con.html?&footer_id=6" target="_blank"
style="color: #333;margin: 2px 0 0 30px;line-height: 20px;display: block">
Privacy policy
</a>
</td>
<td background="#FFFFFF" width="250" height="40" colspan="0" rowspan="0">
<p style="margin: 2px 0 10px 42px;line-height: 20px">
2/77 Prince regent drive <br>
Half moon bay, Auckland 2012 <br>
New Zealand <br>
</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td background="#FFFFFF">
<table cellpadding="0" cellspacing="0" background="#FFFFFF">
<tbody>
<tr style="font-family:sans-serif; vertical-align: top;font-size: 12px;">
<td width="750" height="40" colspan="0" rowspan="0">
<p style="margin: 5px 30px 10px 30px;line-height: 20px">
This email was sent to tmr@tmrjournals.com and is specific to the recipient.
If you have received this email in error please delete it and notify the sender immediately.
</p>
<p style="margin: 0 30px 10px 30px;line-height: 20px">
Copyright © TMR Publishing Group Limited.
</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>

View File

@@ -216,6 +216,23 @@ class Article extends Controller {
return json(['total' => $count, 'data' => $res]);
}
/**
* 获取文章的用户详情
*/
public function getArticleUserDetail(){
$data = $this->request->post();
$rule = new Validate([
'article_id'=>'require'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$article_info = $this->article_obj->where('article_id',$data['article_id'])->find();
$user_info = $this->user_obj->where('user_id',$article_info['user_id'])->find();
$re['userDetail'] = $user_info;
return jsonSuccess($re);
}
/**
* @title 获取文章详情(作者,编辑)
* @description 获取文章详情(作者,编辑)

View File

@@ -136,5 +136,57 @@ class Email extends Controller{
return jsonSuccess($re);
}
/**
* 发送模板邮件
*/
public function pushEmailOnTemplate(){
$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 tttt(){
$str = "home".DS."ds".DS."12312321.jpg";
echo substr($str,strrpos($str,DS)+1);
}
/**
* 上传文章的文件
*/
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()]);
}
}
}
}

View File

@@ -128,5 +128,39 @@ class Journal extends Controller {
return jsonSuccess($re);
}
/**
* 获取期刊详情
*/
public function getJournalDetail(){
$data = $this->request->post();
$rule = new Validate([
'journal_id'=>'require'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$info = $this->journal_obj->where('journal_id',$data['journal_id'])->find();
$re['journal'] = $info;
return jsonSuccess($re);
}
/**
* 获取期刊详情通过文章id
*/
public function getJournalDetailByArticleId(){
$data = $this->request->post();
$rule = new Validate([
'article_id'=>'require'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$article_info = $this->article_obj->where('article_id',$data['article_id'])->find();
$info = $this->journal_obj->where('journal_id',$article_info['journal_id'])->find();
$re['journal'] = $info;
return jsonSuccess($re);
}
}

View File

@@ -9,23 +9,14 @@ class mail {
//put your code here
public function fire(Job $job, $data) {
$res = $this->send($data);
$this->send($data);
$job->delete();
// if($res){
// file_put_contents('/usr/local/email.txt', 'log_time:'.date('Y-m-d H:i:s').' success:to '.$data['email'].PHP_EOL, FILE_APPEND);
// $job->delete();
// }else{
// if($job->attempts()>3){
// file_put_contents('/usr/local/email.txt', 'log_time:'.date('Y-m-d H:i:s').' error:to '.$data['email'].PHP_EOL, FILE_APPEND);
// 第1种处理方式重新发布任务,该任务延迟10秒后再执行
//$job->release(10);
// 第2种处理方式原任务的基础上1分钟执行一次并增加尝试次数
//$job->failed();
// 第3种处理方式删除任务
// $job->delete();
// }
// }
}
public function tgpu(Job $job, $data){
my_tg_pushmail($data);
$job->delete();
}
/**

View File

@@ -76,16 +76,16 @@ function sendEmail($email = '', $title = '', $from_name = '', $content = '', $me
$mail->msgHTML($pre.$content.$net);
//Replace the plain text body with one created manually
$mail->AltBody = '';
if (is_array($attachmentFile)) {
for ($i = 0; $i < count($attachmentFile); $i++) {
$mail->addAttachment($attachmentFile[$i], 'thanks.jpg' . $i); //这里可以是多维数组,然后循环附件的文件和名称
}
} else {
// if (is_array($attachmentFile)) {
// for ($i = 0; $i < count($attachmentFile); $i++) {
// $mail->addAttachment($attachmentFile[$i], 'thanks' . $i.'.jpg'); //这里可以是多维数组,然后循环附件的文件和名称
// }
// } else {
if ($attachmentFile != '') {
//Attach an image file
$mail->addAttachment($attachmentFile, 'thanks.jpg');
}
$mail->addAttachment($attachmentFile, substr($attachmentFile,strrpos($attachmentFile,DS)+1));
}
// }
//send the message, check for errors
if (!$mail->send()) {
$status = 0;
@@ -261,6 +261,24 @@ function my_doiToFrag($data){
}
function my_tg_pushmail($data){
$res = sendEmail($data['email'],$data['title'],$data['title'],$data['content'],$data['tmail'],$data['tpassword'],$data['attachmentFile']);
if(isset($res['status'])){
$log_obj = Db::name('email_log');
$insert['article_id'] = $data['article_id'];
$insert['email'] = $data['email'];
$insert['content'] = $data['content'];
$insert['is_success'] = $res['status'];
$insert['attachment'] = $data['attachmentFile'];
$insert['ctime'] = time();
$log_obj->insert($insert);
$log_obj->close();
}
}
/**
* 增加usermsg
*/