Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -1288,6 +1288,9 @@ class Article extends Base
|
||||
|
||||
//增加usermsg
|
||||
add_usermsg($iArticleUserId, 'Your manuscript has new process: ' . $sTitle, '/articleDetail?id=' . $iId);
|
||||
|
||||
//发送邮件
|
||||
$aEmailResult = $this->sendEmailForAuthor(['article' => $article_info,'user' => $user_info,'journal' => $journal_info]);
|
||||
return json(['code' => 0]);
|
||||
}
|
||||
//终审判断[3个审稿人审稿意见为:同意/1个审稿人审稿意见为:不同意] chengxiaoling 20250825 end
|
||||
@@ -4812,4 +4815,91 @@ class Article extends Base
|
||||
Db::commit();
|
||||
return json_encode(['status' => 1, 'msg' => "The field to which the article belongs has been successfully updated"]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 终审状态-通知作者
|
||||
* @param reviewer_id 审核人ID
|
||||
* @param
|
||||
*/
|
||||
private function sendEmailForAuthor($aParam = [])
|
||||
{
|
||||
|
||||
//稿件信息
|
||||
$aArticle = empty($aParam['article']) ? 0 : $aParam['article'];
|
||||
//作者信息
|
||||
$aUser = empty($aParam['user']) ? 0 : $aParam['user'];
|
||||
//期刊信息
|
||||
$aJournal = empty($aParam['journal']) ? 0 : $aParam['journal'];
|
||||
if(empty($aArticle) || empty($aUser) || empty($aJournal)){
|
||||
return ['status' => 2,'msg' => 'Missing information'];
|
||||
}
|
||||
|
||||
//邮件内容
|
||||
$aEmailConfig = [
|
||||
|
||||
'email_subject' => 'Manuscript Status Update – Final Decision - {accept_sn}',
|
||||
'email_content' => '
|
||||
Dear Dr. {realname},<br><br>
|
||||
I hope this message finds you well.<br><br>
|
||||
We are writing to inform you that your manuscript entitled “[{article_title}]” (Manuscript ID: [{accept_sn}]) has progressed to the final decision stage.<br><br>
|
||||
Thank you once again for choosing to submit your valuable manuscript to our journal.<br><br>
|
||||
Sincerely,<br>
|
||||
Editorial Office<br>
|
||||
<a href="https://www.tmrjournals.com/draw_up.html?issn={journal_issn}">{journal_title}</a><br>
|
||||
Email: {journal_email}<br>
|
||||
Website: {website}'
|
||||
];
|
||||
//数据准备-邮件内容替换
|
||||
$aSearch = [
|
||||
'{accept_sn}' => empty($aArticle['accept_sn']) ? '' : $aArticle['accept_sn'],//accept_sn
|
||||
'{article_title}' => empty($aArticle['title']) ? '' : $aArticle['title'],//文章标题
|
||||
'{abstrart}' => empty($aArticle['abstrart']) ? '' : $aArticle['abstrart'],//文章摘要
|
||||
'{journal_title}' => empty($aJournal['title']) ? '' : $aJournal['title'],//期刊名
|
||||
'{journal_issn}' => empty($aJournal['issn']) ? '' : $aJournal['issn'],
|
||||
'{journal_email}' => empty($aJournal['email']) ? '' : $aJournal['email'],
|
||||
'{website}' => empty($aJournal['website']) ? '' : $aJournal['website'],
|
||||
];
|
||||
|
||||
//邮箱
|
||||
$email = empty($aUser['email']) ? '' : $aUser['email'];//'tmr@tmrjournals.com';//
|
||||
if(empty($email)){
|
||||
return ['status' => 3,'msg' => 'The author\'s email is empty'];
|
||||
}
|
||||
//用户名
|
||||
$realname = empty($aUser['account']) ? '' : $aUser['account'];
|
||||
$realname = empty($aUser['realname']) ? $realname : $aUser['realname'];
|
||||
$aSearch['{realname}'] = $realname;
|
||||
//用户账号
|
||||
$aSearch['{account}'] = empty($aUser['account']) ? '' : $aUser['account'];
|
||||
|
||||
//邮件标题
|
||||
$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'];
|
||||
|
||||
//添加邮件发送日志
|
||||
$iArticleId = empty($aArticle['article_id']) ? 0 : $aArticle['article_id'];
|
||||
$iUserId = empty($aArticle['user_id']) ? 0 : $aArticle['user_id'];
|
||||
$aEmailLog = ['article_id' => $iArticleId,'art_rev_id' => $iArticleId,'reviewer_id' => $iUserId,'type' => 7,'email' => $email,'content' => $content,'create_time' => time(),'is_success' => $iIsSuccess,'msg' => $sMsg];
|
||||
$oReviewer = new \app\common\Reviewer;
|
||||
$iId = $oReviewer->addLog($aEmailLog);
|
||||
|
||||
return ['status' => $iIsSuccess,'msg' => $sMsg];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,13 @@ class Finalreview extends Base
|
||||
Email: {journal_email}<br>
|
||||
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/";
|
||||
@@ -309,7 +316,7 @@ class Finalreview extends Base
|
||||
$sMsg = empty($aResult['data']) ? $iIsSuccess : $aResult['data'];
|
||||
|
||||
//添加邮件发送日志
|
||||
$aEmailLog = ['article_id' => $iArticleId,'art_rev_id' => $iId,'reviewer_id' => $iReviewerId,'type' => 4,'email' => $email,'content' => $content,'create_time' => time(),'is_success' => $iIsSuccess,'msg' => $sMsg];
|
||||
$aEmailLog = ['article_id' => $iArticleId,'art_rev_id' => $iId,'reviewer_id' => $iReviewerId,'type' => 6,'email' => $email,'content' => $content,'create_time' => time(),'is_success' => $iIsSuccess,'msg' => $sMsg];
|
||||
$oReviewer = new \app\common\Reviewer;
|
||||
$iId = $oReviewer->addLog($aEmailLog);
|
||||
|
||||
@@ -377,18 +384,66 @@ class Finalreview extends Base
|
||||
$suggest_for_editor = empty($aParam['suggest_for_editor']) ? '' : $aParam['suggest_for_editor'];
|
||||
$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['is_anonymous'] = empty($aParam['is_anonymous']) ? 2 : $aParam['is_anonymous'];//是否匿名
|
||||
}
|
||||
|
||||
//判断更新参数
|
||||
if(empty($aUpdate)){
|
||||
return json_encode(['status' => 7,'msg' => 'Illegal request']);
|
||||
}
|
||||
|
||||
//数据库更新
|
||||
$aUpdate['is_anonymous'] = empty($aParam['is_anonymous']) ? 2 : $aParam['is_anonymous'];
|
||||
$aWhere = ['id' => $iId];
|
||||
$result = Db::name('article_reviewer_final')->where($aWhere)->limit(1)->update($aUpdate);
|
||||
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"]);
|
||||
@@ -575,7 +630,7 @@ class Finalreview extends Base
|
||||
if(empty($sFileUrl)){
|
||||
continue;
|
||||
}
|
||||
$value['file_url'] = trim($this->sTouGaoUrl,'/').'/public/'.$sFileUrl;
|
||||
// $value['file_url'] = trim($this->sTouGaoUrl,'/').'/public/'.$sFileUrl;
|
||||
$value['artr_ctime'] = empty($value['artr_ctime']) ? '' : date('Y-m-d',$value['artr_ctime']);
|
||||
$aResponse[$key] = $value;
|
||||
}
|
||||
@@ -797,14 +852,14 @@ class Finalreview extends Base
|
||||
}
|
||||
|
||||
//统计各个状态下的数量
|
||||
$aWhere = ['state' => ['between',[0,7]]];
|
||||
$aWhere = ['state' => ['between',[0,8]]];
|
||||
if(!empty($aParam['journal_id'])){
|
||||
$aWhere['journal_id'] = ['in',$aParam['journal_id']];
|
||||
}
|
||||
$aCountNum = Db::name('article')->field("state,count(*) as num")->where($aWhere)->group("state")->select();
|
||||
$aCountNum = empty($aCountNum) ? [] : array_column($aCountNum, 'num','state');
|
||||
$aCountNumData = [];
|
||||
for ($i = 0; $i <= 7; $i++) {
|
||||
for ($i = 0; $i <= 8; $i++) {
|
||||
$aCountNumData[$i] = empty($aCountNum[$i]) ? 0 : $aCountNum[$i];
|
||||
}
|
||||
return json_encode(['status' => 1,'msg' => 'success','data' => ['total' => $iCount,'lists' => $aArticleLists,'count_num' => $aCountNumData]]);
|
||||
@@ -939,13 +994,14 @@ class Finalreview extends Base
|
||||
if (!empty($aFileList)) {
|
||||
foreach ($aFileList as $value) {
|
||||
$type = empty($value['type_name']) ? '' : $value['type_name'];
|
||||
$aData[$type] = [
|
||||
$aData[$type][] = [
|
||||
'file_id' => $value['file_id'],
|
||||
'file_url' => $value['file_url'],
|
||||
'ctime' => empty($value['ctime']) ? '' : date('Y-m-d',$value['ctime'])
|
||||
];
|
||||
}
|
||||
}
|
||||
$aData['manuscirpt'] = empty($aData['manuscirpt'][0]) ? [] : $aData['manuscirpt'][0];
|
||||
return json_encode(['status' => 1,'msg' => 'success','data' => $aData]);
|
||||
}
|
||||
/**
|
||||
@@ -967,7 +1023,7 @@ class Finalreview extends Base
|
||||
|
||||
//返回链接
|
||||
$sJumpUrl = 'edit_per_text_yq?a_id='.$iArticleId;//拒绝
|
||||
return trim($this->sTouGaoUrl,'/').'/'.$sJumpUrl.'&r_id=' . $record_id . '&act=' . $code;
|
||||
return trim($this->sTouGaoUrl,'/').'/'.$sJumpUrl.'&r_id=' . $record_id;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user