From c622aa177e01a2e3cdc7c7d0e0f6fe1adda493ae Mon Sep 17 00:00:00 2001 From: wangzhaocui <18722597281> Date: Fri, 1 Apr 2022 16:47:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A1=E7=A8=BF=E6=84=8F=E8=A7=81=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E5=AE=A1=E7=A8=BF=E4=BA=BA=20=E5=88=86=E6=AD=A7?= =?UTF-8?q?=E6=84=8F=E8=A7=81=E9=80=9A=E7=9F=A5=E5=AE=A1=E7=A8=BF=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/controller/Article.php | 92 +++++++++++++++++++++++++- 1 file changed, 89 insertions(+), 3 deletions(-) diff --git a/application/api/controller/Article.php b/application/api/controller/Article.php index 603de0e..5ca54a4 100644 --- a/application/api/controller/Article.php +++ b/application/api/controller/Article.php @@ -696,7 +696,7 @@ class Article extends Controller { return json(['code'=>1,'msg'=>"More than two available reviewer-comments are necessary before going next step."]); } } - + //添加文章状态信息(如果状态未更新可做通话用,并结束操作) $insert_data['article_id'] = $data['articleId']; $insert_data['content'] = $data['editormsg']; @@ -718,6 +718,11 @@ class Article extends Controller { $update_data['rstime'] = time(); } $this->article_obj->where($where_article)->update($update_data); + + //拒稿或者录用 - 发送审稿意见 + if( $data['state'] == 3 || $data['state'] == 5 ){ + $this->sendEmailToReviewer($data['articleId'],$data['state']); + } } //发送文章状态更改邮件 @@ -1379,8 +1384,21 @@ class Article extends Controller { $tt .= 'Sincerely,
Editorial Office
'.$journal_info['title'].'
'; $tt .= 'Email: '.$journal_info['email'].'
'; $tt .= 'Website:'.$journal_info['website'].''; - sendEmail($author_info['email'], $journal_info['title'], $journal_info['title'], $tt,$journal_info['email'],$journal_info['epassword']); - + + //sendEmail($author_info['email'], $journal_info['title'], $journal_info['title'], $tt,$journal_info['email'],$journal_info['epassword']); + + $sendUser=[ + 'title'=>$journal_info['title'], // 邮件标题 + 'content'=>$tt,//邮件内容 + 'user_id'=>$author_info['user_id'], //收件人ID + 'email'=>$author_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'); + //添加转换表数据 $art_insert['art_aut_id'] = $art_aut_id; $art_insert['journal_id'] = $journal_id; @@ -1628,4 +1646,72 @@ class Article extends Controller { return substr($frag, 0,-1); } + // 给审稿人发送邮件- 稿件的基本情况 + private function sendEmailToReviewer($articleId,$state){ + //articleId = 1037; + //$state = 3; + $resState = $state==3?"Reject":"Accept"; + $allArticleReviewer = $this->article_reviewer_obj->field('t_user.email,t_user.realname,t_article_reviewer.reviewer_id,t_article_reviewer_question.recommend,t_article_reviewer_question.comments') + ->join('t_article_reviewer_question','t_article_reviewer_question.art_rev_id = t_article_reviewer.art_rev_id','LEFT') + ->join('t_user','t_user.user_id = t_article_reviewer.reviewer_id','LEFT') + ->where('t_article_reviewer.article_id',$articleId) + ->where('t_article_reviewer.state','in',[1,2,3]) + ->select(); + // 根据文章ID查询journal_id + $journalInfo = $this->article_obj->field('t_journal.journal_id,t_journal.title,t_journal.email,t_journal.epassword') + ->join('t_journal','t_journal.journal_id = t_article.journal_id','LEFT') + ->where('t_article.article_id',$articleId) + ->find(); + // 文章信息 + $articleInfo = $this->article_obj->where('article_id',$articleId)->find(); + $pushData=[ + 'title'=>$journalInfo['title'], // 邮件标题 + 'journal_id'=>$journalInfo['journal_id'], // 期刊ID + 'sendEmail'=>$journalInfo['email'], // 期刊邮箱 + 'sendPassword'=>$journalInfo['epassword'], // 期刊密码 + 'from_name'=>$journalInfo['title'] + ]; + $difference = "Please check the final decision of the manuscript you reviewed.

Dear Reviewer,
"; + $difference .= "The final decision of the manuscript ".'"' . $articleInfo['accept_sn']. '"' ." is ".'"'.$resState. '"' .".

"; + $difference .= "We sincerely appreciate the time you spent reading and commenting on manuscripts, and we are very grateful for your willingness to serve in this role. Although final decisions are always editorial,the reviewers bring to our deliberations scientific insights, and passion.

"; + $difference .="We note that the final decision is contrary to your decision.
You deserve to know all peer review decisions and comments following as peer reviewer:
"; + + $recommend=[ + 1=>'Accept with minor changes', + 2=>'Accept subject to revisions, as noted in comments', + 3=>'Reject in current form, but may be resubmitted', + 4=>'Reject, with no resubmission', + ]; + + $all = "Please check the final decision of the manuscript you reviewed.

Dear Reviewer,
"; + $all .= "The final decision of the manuscript ".'"' . $articleInfo['accept_sn']. '"' ." is ".'"'.$resState. '"' .".

"; + $all .= "We sincerely appreciate the time you spent reading and commenting on manuscripts, and we are very grateful for your willingness to serve in this role. Although final decisions are always editorial,the reviewers bring to our deliberations scientific insights, and passion.

"; + $all .= "Please let us know your feedback at publisher@tmrjournals.com."; + foreach ($allArticleReviewer as $k => $value){ + // 最终意见发给全部审稿人 + $pushData['content'] = $all; + $pushData['user_id'] = $value['reviewer_id']; + $pushData['email'] =$value['email']; + Queue::push('app\api\job\domail@fire',$pushData,'domail'); + $num = $value['recommend']; + $difference.= "
Reviewer ". ($k+1).' : '.$recommend[$num] ." (".preg_replace("/\t/","",$value['comments']).")
"; + } + $difference .= "

Please let us know your feedback at publisher@tmrjournals.com."; + // 分歧稿件 + foreach ($allArticleReviewer as $k => $value){ + $pushData['content'] = $difference; + $pushData['user_id'] = $value['reviewer_id']; + $pushData['email'] =$value['email']; + if($state == 3 && ($value['recommend'] == 1 || $value['recommend'] == 2)){ + Queue::push('app\api\job\domail@fire',$pushData,'domail'); + } + if($state == 5 && ($value['recommend'] == 3 || $value['recommend'] == 4)){ + Queue::push('app\api\job\domail@fire',$pushData,'domail'); + } + } + + + + } + }