终审发邮件
This commit is contained in:
@@ -33,6 +33,13 @@ class Finalreview extends Base
|
|||||||
Email: {journal_email}<br>
|
Email: {journal_email}<br>
|
||||||
Website: {website}'
|
Website: {website}'
|
||||||
],
|
],
|
||||||
|
'editor' => [
|
||||||
|
|
||||||
|
'email_subject' => 'Final decision for manuscript - {accept_sn}',
|
||||||
|
'email_content' => '
|
||||||
|
Dear Editor,<br><br>
|
||||||
|
Please check the final decision for manuscript ID [{accept_sn}].'
|
||||||
|
]
|
||||||
];
|
];
|
||||||
//投稿系统地址
|
//投稿系统地址
|
||||||
private $sTouGaoUrl = "https://submission.tmrjournals.com/";
|
private $sTouGaoUrl = "https://submission.tmrjournals.com/";
|
||||||
@@ -377,18 +384,66 @@ class Finalreview extends Base
|
|||||||
$suggest_for_editor = empty($aParam['suggest_for_editor']) ? '' : $aParam['suggest_for_editor'];
|
$suggest_for_editor = empty($aParam['suggest_for_editor']) ? '' : $aParam['suggest_for_editor'];
|
||||||
$suggest_for_author = empty($aParam['suggest_for_author']) ? '' : $aParam['suggest_for_author'];
|
$suggest_for_author = empty($aParam['suggest_for_author']) ? '' : $aParam['suggest_for_author'];
|
||||||
$aUpdate = ['state' => $iState,'update_time' => time(),'review_time' => time(),'suggest_for_editor' => $suggest_for_editor,'suggest_for_author' => $suggest_for_author];
|
$aUpdate = ['state' => $iState,'update_time' => time(),'review_time' => time(),'suggest_for_editor' => $suggest_for_editor,'suggest_for_author' => $suggest_for_author];
|
||||||
|
$aUpdate['is_anonymous'] = empty($aParam['is_anonymous']) ? 2 : $aParam['is_anonymous'];//是否匿名
|
||||||
}
|
}
|
||||||
|
//判断更新参数
|
||||||
if(empty($aUpdate)){
|
if(empty($aUpdate)){
|
||||||
return json_encode(['status' => 7,'msg' => 'Illegal request']);
|
return json_encode(['status' => 7,'msg' => 'Illegal request']);
|
||||||
}
|
}
|
||||||
|
|
||||||
//数据库更新
|
//数据库更新
|
||||||
$aUpdate['is_anonymous'] = empty($aParam['is_anonymous']) ? 2 : $aParam['is_anonymous'];
|
|
||||||
$aWhere = ['id' => $iId];
|
$aWhere = ['id' => $iId];
|
||||||
$result = Db::name('article_reviewer_final')->where($aWhere)->limit(1)->update($aUpdate);
|
$result = Db::name('article_reviewer_final')->where($aWhere)->limit(1)->update($aUpdate);
|
||||||
if(!$result){
|
if(!$result){
|
||||||
json_encode(['status' => 8,'msg' => "Review failed"]);
|
return json_encode(['status' => 8,'msg' => "Review failed"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
//发送邮件
|
||||||
|
if(in_array($iState, [1,2,3])){//有审核结果发送邮件提醒编辑
|
||||||
|
//查询文章所属期刊
|
||||||
|
$aWhere = ['article_id' => $iArticleId];
|
||||||
|
$aArticle = Db::name('article')->field('journal_id,state,accept_sn')->where($aWhere)->find();
|
||||||
|
$iJournalId = empty($aArticle['journal_id']) ? 0 : $aArticle['journal_id'];//期刊ID
|
||||||
|
//邮件发送
|
||||||
|
//数据准备-查询期刊信息
|
||||||
|
$aWhere = ['journal_id' => $iJournalId,'state' => 0];
|
||||||
|
$aJournal = Db::name('journal')->field('title,issn,editorinchief,zname,abbr,alias,email,epassword,website,editor_id')->where($aWhere)->find();
|
||||||
|
$email = empty($aJournal['email']) ? '' : $aJournal['email'];
|
||||||
|
if(!empty($email)){
|
||||||
|
//数据准备-获取邮件模版
|
||||||
|
$aEmailConfig= empty($this->aEmailConfig['editor']) ? [] : $this->aEmailConfig['editor'];
|
||||||
|
//数据准备-邮件内容替换
|
||||||
|
$aSearch = [
|
||||||
|
'{accept_sn}' => empty($aArticle['accept_sn']) ? '' : $aArticle['accept_sn'],//accept_sn
|
||||||
|
];
|
||||||
|
//邮件标题
|
||||||
|
$title = str_replace(array_keys($aSearch), array_values($aSearch),$aEmailConfig['email_subject']);
|
||||||
|
//邮件内容变量替换
|
||||||
|
$content = str_replace(array_keys($aSearch), array_values($aSearch), $aEmailConfig['email_content']);
|
||||||
|
//带模版的邮件内容
|
||||||
|
$pre = \think\Env::get('emailtemplete.pre');
|
||||||
|
$net = \think\Env::get('emailtemplete.net');
|
||||||
|
$net1 = str_replace("{{email}}",trim($email),$net);
|
||||||
|
$content=$pre.$content.$net1;
|
||||||
|
//发送邮件邮箱配置
|
||||||
|
$memail = empty($aJournal['email']) ? '' : $aJournal['email'];
|
||||||
|
$mpassword = empty($aJournal['epassword']) ? '' : $aJournal['epassword'];
|
||||||
|
//期刊标题
|
||||||
|
$from_name = empty($aJournal['title']) ? '' : $aJournal['title'];
|
||||||
|
|
||||||
|
//发送邮件
|
||||||
|
$aResult = sendEmail($email,$title,$from_name,$content,$memail,$mpassword);
|
||||||
|
$iStatus = empty($aResult['status']) ? 1 : $aResult['status'];
|
||||||
|
$iIsSuccess = $iStatus == 1 ? 1 : 2;
|
||||||
|
$sMsg = empty($aResult['data']) ? $iIsSuccess : $aResult['data'];
|
||||||
|
|
||||||
|
//添加邮件发送日志
|
||||||
|
$editor_id = empty($aJournal['editor_id']) ? 0 : $aJournal['editor_id'];
|
||||||
|
$aEmailLog = ['article_id' => $iArticleId,'art_rev_id' => $iId,'reviewer_id' => $editor_id,'type' => 5,'email' => $email,'content' => $content,'create_time' => time(),'is_success' => $iIsSuccess,'msg' => $sMsg];
|
||||||
|
$oReviewer = new \app\common\Reviewer;
|
||||||
|
$iId = $oReviewer->addLog($aEmailLog);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//返回结果
|
//返回结果
|
||||||
return json_encode(['status' => 1,'msg' => "Reviewed successfully"]);
|
return json_encode(['status' => 1,'msg' => "Reviewed successfully"]);
|
||||||
|
|||||||
Reference in New Issue
Block a user