This commit is contained in:
wangjinlei
2023-07-31 16:53:59 +08:00
parent 0b706eca4c
commit eaef11fbc2
6 changed files with 205 additions and 40 deletions

View File

@@ -4,6 +4,7 @@ namespace app\api\controller;
use app\api\controller\Base;
use think\Db;
use think\Queue;
use think\Validate;
/**
@@ -51,7 +52,7 @@ class Reviewer extends Base
}
/**
* @title 获取待审审稿实例列表
* @title 获取待审审稿实例列表,包含复审待审
* @description 获取待审审稿实例列表
* @author wangjinlei
* @url /api/Reviewer/getReviewerListPending
@@ -67,7 +68,8 @@ class Reviewer extends Base
//获取审稿人基本信息
$reviewer_info = $this->user_obj->where('user_id', $data['user_id'])->find();
$res = $this->article_reviewer_obj->field('t_article_reviewer.*,t_article.title article_title,t_article.abstrart,t_article.major_id,t_article.cmajor_id,t_article.type,t_journal.title journal_title,t_article.accept_sn accept_sn')
$res = $this->article_reviewer_obj
->field('t_article_reviewer.*,t_article.title article_title,t_article.abstrart,t_article.major_id,t_article.cmajor_id,t_article.type,t_journal.title journal_title,t_article.accept_sn accept_sn')
->join('t_article', 't_article_reviewer.article_id = t_article.article_id', 'LEFT')
->join('t_journal', 't_article.journal_id = t_journal.journal_id', 'LEFT')
->where('t_article_reviewer.reviewer_id', $reviewer_info['user_id'])
@@ -88,7 +90,18 @@ class Reviewer extends Base
$res[$k]['cmajor'] = $cmajor['title'];
}
//复审的稿件列表
$repeats = $this->article_reviewer_obj
->field('t_article_reviewer.*,t_article.title article_title,t_article.abstrart,t_article.major_id,t_article.cmajor_id,t_article.type,t_journal.title journal_title,t_article.accept_sn accept_sn')
->join("t_article_reviewer_repeat","t_article_reviewer_repeat.art_rev_id = t_article_reviewer.art_rev_id","left")
->join('t_article', 't_article_reviewer.article_id = t_article.article_id', 'LEFT')
->join('t_journal', 't_article.journal_id = t_journal.journal_id', 'LEFT')
->where("t_article_reviewer.reviewer_id",$reviewer_info['user_id'])
->where("t_article_reviewer_repeat.state",0)
->select();
$re['lists'] = $res;
$re['repeats'] = $repeats;
return jsonSuccess($re);
}
@@ -104,8 +117,16 @@ class Reviewer extends Base
return jsonError($rule->getError());
}
$article_reviewer_info = $this->article_reviewer_obj->where('art_rev_id',$data['art_rev_id'])->find();
//审查添加的合法性
$repeats = $this->article_reviewer_repeat_obj->where('art_rev_id',$data['art_rev_id'])->select();
$last = count($repeats)-1;
if($repeats&&($repeats[$last]['state']==0||$repeats[$last]['recommend']!=3)){
return jsonError("create error");
}
$reviewer_info = $this->user_obj->where('user_id',$article_reviewer_info['reviewer_id'])->find();
$article_info = $this->article_obj->where('article_id',$article_reviewer_info['article_id'])->find();
$journal_info = $this->journal_obj->where("journal_id",$article_info['journal_id'])->find();
//添加实例数据
$insert['art_rev_id'] = $data['art_rev_id'];
@@ -113,6 +134,21 @@ class Reviewer extends Base
$this->article_reviewer_repeat_obj->insert($insert);
//发送邮件至审稿人,提醒到系统内复审稿件
$tt = "Dear Reviewer,<br/><br/>";
$tt .= "Thank you for your support and valuable feedback to our journal. According to your comments, the author has made revisions to the article and submitted the revised manuscript to us.<br/><br/>";
$tt .= 'To ensure the quality and accuracy of the article, we would like to ask for your re-review of the revised manuscript within 5 days. Please log in to the <a href="https://submission.tmrjournals.com">Submission System</a> and click on "Peer Review" to re-review the revised manuscript.If you fail to complete the re-review, we will consider your initial opinion as the final decision.<br/><br/>';
$tt .= "We appreciate your time and effort to the journal and look forward to hearing back from you soon.<br/><br/>";
$tt .= 'Sincerely,<br>Editorial Office<br>';
$tt .= $journal_info['title'] . '<br>';
$tt .= 'Email: ' . $journal_info['email'] . '<br>';
$tt .= 'Website: ' . $journal_info['website'];
$maidata['email'] = $reviewer_info['email'];
$maidata['title'] = "Invitation for Re-review of Revised Manuscript";
$maidata['content'] = $tt;
$maidata['tmail'] = $journal_info['email'];
$maidata['tpassword'] = $journal_info['epassword'];
Queue::push('app\api\job\mail@fire', $maidata, "tmail");
return jsonSuccess([]);
}
@@ -307,6 +343,48 @@ class Reviewer extends Base
return json(['code' => 0]);
}
/**获取复审稿件详情
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getReviewerRepeatDetail(){
$data = $this->request->post();
$rule = new Validate([
"art_rev_id"=>'require'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$art_rev_info = $this->article_reviewer_obj->where('art_rev_id',$data['art_rev_id'])->find();
$article_info = $this->article_obj
->field("t_article.*,t_journal.title journal_title,t_journal.website")
->join("t_journal","t_journal.journal_id = t_article.journal_id","left")
->where('t_article.article_id',$art_rev_info['article_id'])
->find();
//组装审稿时间线
$c_question = $this->article_reviewer_question_obj->where('art_rev_id',$data['art_rev_id'])->find();
$question[] = $c_question;
$re_question = $this->article_reviewer_repeat_obj->where('art_rev_id',$data['art_rev_id'])->select();
foreach ($re_question as $v){
$question[] = $v;
}
$art_rev_info['question'] = $question;
$re['art_rev_info'] = $art_rev_info;
//组装文章文件
$response = $this->article_response_to_reviewer_obj->where('article_id',$article_info['article_id'])->select();
$files['response'] = $response;
$files['manuscript'] = $this->article_file_obj->where('article_id',$article_info['article_id'])->where('type_name',"manuscirpt")->order("ctime")->select();
$files['figures'] = $this->article_file_obj->where('article_id',$article_info['article_id'])->where('type_name',"picturesAndTables")->order("ctime")->select();
$re['files'] = $files;
$re['article_info'] = $article_info;
return jsonSuccess($re);
}
/**
* @title 发起审稿
* @description 发起审稿
@@ -484,6 +562,19 @@ class Reviewer extends Base
->find();
//文章类型转译
$res['atype'] = translateType($res['atype']);
//复审相关
$repeats = $this->article_reviewer_repeat_obj->where('art_rev_id',$data['revid'])->select();
if($repeats){
$last = count($repeats)-1;
$res['can_repeat'] = ($repeats[$last]['state']==1&&$repeats[$last]['recommend']==3)?1:0;
$res['repeat'] = $repeats;
}else{//不存在复审实例,可添加
$res['can_repeat'] = 1;
$res['repeat'] = [];
}
//更改实例状态(消息提醒)
if ($data['human'] == 'editor') {
$up_data['reviewer_act'] = 0;
@@ -840,6 +931,37 @@ class Reviewer extends Base
// sendEmail("1586428462@qq.com", "title", "ttttt", "content", 'tmr@tmrjournals.com', "Wu9999999999", $reviewer_ZS);
// }
public function questionRepeat(){
$data = $this->request->post();
$rule = new Validate([
"art_rev_rep_id"=>"require",
"recommend"=>"require"
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$repeat_info = $this->article_reviewer_repeat_obj->where('art_rev_rep_id',$data['art_rev_rep_id'])->find();
$update['recommend'] = $data['recommend'];
$update['stime'] = time();
if($data['recommend']==3){
$update['content'] = isset($data['content'])?trim($data['content']):'';
}
$update['state'] = 1;
$this->article_reviewer_repeat_obj->where('art_rev_rep_id',$data['art_rev_rep_id'])->update($update);
//更新审稿实例
if($data['recommend']!=3){
$state = $data['recommend']==1?3:2;
$this->article_reviewer_obj->where("art_rev_id",$repeat_info['art_rev_id'])->update(['state'=>$state]);
}
//复审后发送邮件
return jsonSuccess([]);
}
/**
* 获取问卷详情
*/