This commit is contained in:
wangjinlei
2022-02-18 17:39:32 +08:00
parent ddd4358f41
commit 4c6f6d97c1
6 changed files with 521 additions and 98 deletions

View File

@@ -29,6 +29,7 @@ class Article extends Controller {
protected $login_auto_obj = '';
protected $major_obj = "";
protected $major_to_journal_obj = '';
protected $reviewer_from_author_obj = '';
public function __construct(\think\Request $request = null) {
parent::__construct($request);
@@ -50,6 +51,7 @@ class Article extends Controller {
$this->login_auto_obj = Db::name('login_auto');
$this->major_obj = Db::name("major");
$this->major_to_journal_obj = Db::name('major_to_journal');
$this->reviewer_from_author_obj = Db::name("reviewer_from_author");
}
/**
@@ -146,10 +148,24 @@ class Article extends Controller {
return json(['total' => $count, 'data' => $res]);
}
/**
* 获取文章详情(作者,编辑)
* @title 获取文章详情(作者,编辑)
* @description 获取文章详情(作者,编辑)
* @author wangjinlei
* @url /api/Article/getArticleDetail
* @method POST
*
* @param name:articleId type:int require:1 desc:文章id
* @param name:human type:string require:1 desc:editor/author
*
* @return article:文章信息#
* @return msg:文章跟踪信息#
* @return authors:作者信息#
* @return suggest:建议信息#
* @return transfer:转投信息#
* @return transinfo:建议转投信息#
* @return major:领域信息#
*
*/
public function getArticleDetail() {
//接受参数
@@ -178,17 +194,19 @@ class Article extends Controller {
}
//查询major信息
$major_data = [];
if($article_res['major_id']!=0){
$major_data['major'] = $this->reviewer_major_obj->where('major_id',$article_res['major_id'])->find();
}else{
$major_data['major'] = null;
}
if($article_res['cmajor_id']!=0){
$major_data['cmajor'] = $this->reviewer_major_obj->where('major_id',$article_res['cmajor_id'])->find();
}else{
$major_data['cmajor'] = null;
}
// $major_data = [];
// if($article_res['major_id']!=0){
// $major_data['major'] = $this->reviewer_major_obj->where('major_id',$article_res['major_id'])->find();
// }else{
// $major_data['major'] = null;
// }
// if($article_res['cmajor_id']!=0){
// $major_data['cmajor'] = $this->reviewer_major_obj->where('major_id',$article_res['cmajor_id'])->find();
// }else{
// $major_data['cmajor'] = null;
// }
//新领域查询
$major = $this->getMajorStr($article_res['major_id'])==""?"":substr($this->getMajorStr($article_res['major_id']), 3);
//查询文章作者信息
$author_res = $this->article_author_obj->where('article_id', $data['articleId'])->where('state', 0)->select();
@@ -212,9 +230,24 @@ class Article extends Controller {
}
$this->article_obj->where('article_id', $data['articleId'])->update($up_data);
return json(['article' => $article_res, 'msg' => $article_msg, 'authors' => $author_res,'suggest'=>$suggest,'transfer'=>$transfer_res,'transinfo'=>$transfer_info,'major'=>$major_data]);
return json(['article' => $article_res, 'msg' => $article_msg, 'authors' => $author_res,'suggest'=>$suggest,'transfer'=>$transfer_res,'transinfo'=>$transfer_info,'major'=>$major]);
}
private function getMajorStr($major_id){
$frag = '';
$major_info = $this->major_obj->where('major_id',$major_id)->find();
if($major_info==null){
return '';
}
if($major_info['major_level']==1){
return '';
}else{
$frag = $this->getMajorStr($major_info['pid']).' > '.$major_info['major_title'];
}
return $frag;
}
/**
* 作者同意转投
*/
@@ -492,6 +525,33 @@ class Article extends Controller {
$this->article_obj->where($where_article)->update(['editor_act'=>1]);
return json(['code' => 0]);
}
//接收文章必须有两个及以上的大于40个字的对作者的评论,除去news和comment类型的文章
if($data['state']==5&&$article_info['type']!="N"&&$article_info['type']!="T"){
//定义符合条件的数量
$rev_real_num = 0;
//获取通过的审稿意见数
$rev_list = $this->article_reviewer_obj
->field('t_article_reviewer_question.*')
->join("t_article_reviewer_question",'t_article_reviewer_question.art_rev_id = t_article_reviewer.art_rev_id','left')
->where('t_article_reviewer.article_id',$article_info['article_id'])
->where('t_article_reviewer.state','in',[1,3])
->select();
foreach ($rev_list as $v){
if(preg_match('/[\x{4e00}-\x{9fa5}]/u', $v['comments'])>0){//含有中文
if(mb_strlen($v['comments'], 'UTF8')>=60){
$rev_real_num++;
}
}else{//不含中文
$carray = explode(" ", $v['comments']);
if(count($carray)>=40){
$rev_real_num++;
}
}
}
if($rev_real_num<2){
return json(['code'=>1,'msg'=>"More than two available reviewer-comments are necessary before going next step."]);
}
}
$update_data['state'] = $data['state'];
$update_data['editor_act'] = 1;
//更新文章状态
@@ -507,7 +567,6 @@ class Article extends Controller {
//发送文章状态更改邮件
if($data['state']==3){//拒稿
if($data['trsjournal']==0){
$tt = '"'.$article_info['title'].'"<br>';
$tt .= $article_info['accept_sn'].'<br>';
$tt .= 'journal:'.$journal_info['title'].'<br>';
@@ -792,8 +851,8 @@ class Article extends Controller {
. ' in the journal '.$journal_info['title'].'. <br>';
$tt .= 'Please bring into our knowledge if there is any potential Conflict of Interest. If you agree to review this manuscript, we ask you to complete your review and submit it by submission system within 10 days of receipt of the manuscript.<br><br>';
$tt .= 'Thank you for your consideration.<br> Look forward for your reply.<br>';
// $tt .= '<a href="'.$this->creatLoginUrlForreviewer($reviewer_info,$res).'">Click here to review the article</a><br>';
$tt .= '<a href="https://submission.tmrjournals.com/">Click here to review the article</a><br>';
$tt .= '<a href="'.$this->creatLoginUrlForreviewer($reviewer_info,$res).'">Click here to review the article</a><br>';
// $tt .= '<a href="https://submission.tmrjournals.com/">Click here to review the article</a><br>';
// $tt .= '<a href="">Click on the link to reject the review of this manuscript</a><br>';
$tt .= 'Your username:'.$reviewer_info['account'].'<br><br>';
$tt .= 'Your original password:123456qwe, if you have reset the password, please login with the new one or click the "<a href="https://submission.tmrjournals.com/retrieve">forgot password</a>".<br>';
@@ -802,7 +861,7 @@ class Article extends Controller {
$tt .= $journal_info['title'].'<br>';
$tt .= 'Email:'.$journal_info['email'].'<br>';
$tt .= 'Website:'.$journal_info['website'];
sendEmail($reviewer_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
// sendEmail($reviewer_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
//记录userlog
$log_data['user_id'] = $article_info['editor_id'];
@@ -895,11 +954,12 @@ class Article extends Controller {
}
$journal_info = $this->journal_obj->where('journal_id', $data['journal'])->find();
//首先查重是否重复投稿
$checkArticle = $this->article_obj->where("title",trim($data['title']))->find();
if($checkArticle!=null){
return json(['code'=>1,'msg'=>'Warning: you re-submitting the article!']);
$checkArticle = $this->article_obj->where("title",trim($data['title']))->select();
foreach ($checkArticle as $v){
if($v['state']!=3){
return json(['code'=>1,'msg'=>'Warning: you are re-submitting the article!']);
}
}
Db::startTrans();
@@ -913,7 +973,7 @@ class Article extends Controller {
$inset_data['accept_sn'] = getArticleSN($journal_info['abbr'],$data['type']);
$inset_data['type'] = $data['type'];
$inset_data['major_id'] = $data['major'];
$inset_data['cmajor_id'] = $data['cmajor'];
// $inset_data['cmajor_id'] = $data['cmajor'];
$inset_data['approval'] = $data['approval']=='true'?1:0;
$inset_data['abstrart'] = $data['abstrart'];
$inset_data['author_act'] = 1;
@@ -1010,6 +1070,73 @@ class Article extends Controller {
}
}
/**
* 添加审稿人来自通讯作者
*/
private function addReviewerFromReportAuthor($art_aut_id,$journal_id){
$journal_info = $this->journal_obj->where('journal_id',$journal_id)->find();
//判断通讯作者信息是否合规
$author_info = $this->article_author_obj->where('art_aut_id',$art_aut_id)->find();
if(!preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/",$author_info['email'])){
return ;
}
//判断目前的状态进行下一步流程
$user_info = $this->user_obj->where('email',$author_info['email'])->where('state',0)->find();
if($user_info==null){//不存在用户
//添加用户,发送邮件
$user_insert['account'] = $author_info['email'];
$user_insert['password'] = md5("123456qwe");
$user_insert['email'] = $author_info['email'];
$user_insert['realname'] = $author_info['firstname']." ".$author_info['lastname'];
$user_insert['ctime'] = time();
$this->user_obj->insert($user_insert);
//发送邮件
$tt = 'Dear Dr. '.$user_insert['realname'].'<br><br>';
$tt .= 'Thank you for submitting your paper to '.$journal_info['title'].' as the corresponding author.<br>';
$tt .= 'In order to provide a better online experience for authors, we have set up your account in our submission system.<br><br>';
$tt .= 'You could log in with your account in https://submission.tmrjournals.com/login <br>';
$tt .= 'Your username:'.$author_info['email'].'<br>';
$tt .= 'Your password:123456qwe (you could change your password in the system by yourself later.)<br><br>';
$tt .= 'Thank you so much for your kindly support.<br><br>';
$tt .= 'Sincerely,<br>Editorial Office<br>'.$journal_info['title'].'<br>';
$tt .= 'Email: '.$journal_info['email'].'<br>';
$tt .= 'Website:<a href="'.$journal_info['website'].'">'.$journal_info['website'].'</a>';
sendEmail($author_info['email'], $journal_info['title'], $journal_info['title'], $tt,$journal_info['email'],$journal_info['epassword']);
//添加转换表数据
$art_insert['art_aut_id'] = $art_aut_id;
$art_insert['journal_id'] = $journal_id;
$art_insert['rfa_ctime'] = time();
$this->reviewer_from_author_obj->insert($art_insert);
return ;
}
$reviewer_check = $this->reviewer_to_journal_obj->where('reviewer_id',$user_info['user_id'])->where('state',0)->find();
$reviewer_this_check = $this->reviewer_to_journal_obj->where('reviewer_id',$user_info['user_id'])->where('journal_id',$journal_id)->where('state',0)->find();
if($reviewer_check == null){//存在用户但不是审稿人
//添加转换表数据
$art_insert['art_aut_id'] = $art_aut_id;
$art_insert['journal_id'] = $journal_id;
$art_insert['rfa_ctime'] = time();
$this->reviewer_from_author_obj->insert($art_insert);
return ;
}else{
if($reviewer_this_check==null){
//直接添加审稿人
$reviewer_insert['reviewer_id'] = $user_info['user_id'];
$reviewer_insert['journal_id'] = $journal_id;
$reviewer_insert['account'] = $author_info['email'];
$reviewer_insert['journal_title'] = $journal_info['title'];
$reviewer_insert['ctime'] = time();
$this->reviewer_to_journal_obj->insert($reviewer_insert);
return ;
}else{
return ;
}
}
}
/**
* 作者发送消息