审稿人推荐作者修改
This commit is contained in:
@@ -183,7 +183,18 @@ class Reviewer
|
|||||||
}
|
}
|
||||||
//查询作者所属机构
|
//查询作者所属机构
|
||||||
$aAuthor = json_decode($this->getAuthor($aArticle),true);
|
$aAuthor = json_decode($this->getAuthor($aArticle),true);
|
||||||
$sCompany = empty($aAuthor['data']) ? '' : $aAuthor['data'];
|
$aAuthorResult = empty($aAuthor['data']) ? [] : $aAuthor['data'];
|
||||||
|
$sCompany = empty($aAuthorResult['company']) ? '' : $aAuthorResult['company'];
|
||||||
|
|
||||||
|
//文章作者
|
||||||
|
$aAuthorId = empty($aAuthorResult['user_id']) ? [] : $aAuthorResult['user_id'];
|
||||||
|
|
||||||
|
//文章作者机构信息
|
||||||
|
$aAuthorCompany = empty($aAuthorResult['author']) ? [] : array_unique(array_column($aAuthorResult['author'], 'company'));
|
||||||
|
//审稿人机构
|
||||||
|
$aReviewerCompany = empty($aAuthorResult['company_list']) ? [] : array_unique(array_values($aAuthorResult['company_list']));
|
||||||
|
$aAuthorCompany = array_unique(array_merge($aAuthorCompany,$aReviewerCompany));
|
||||||
|
|
||||||
//获取劣迹审稿人
|
//获取劣迹审稿人
|
||||||
$aBlack = json_decode($this->getBlackReviewer(),true);
|
$aBlack = json_decode($this->getBlackReviewer(),true);
|
||||||
$aBlack = empty($aBlack['data']) ? [] : $aBlack['data'];
|
$aBlack = empty($aBlack['data']) ? [] : $aBlack['data'];
|
||||||
@@ -200,6 +211,11 @@ class Reviewer
|
|||||||
|
|
||||||
// 查询符合公司条件的审稿人ID,确保去重
|
// 查询符合公司条件的审稿人ID,确保去重
|
||||||
$aWhere = ['state' => 0, 'company' => ['<>', $sCompany]];
|
$aWhere = ['state' => 0, 'company' => ['<>', $sCompany]];
|
||||||
|
if(!empty($aAuthorCompany)){
|
||||||
|
array_push($aAuthorCompany, $sCompany);
|
||||||
|
$aAuthorCompany = array_unique($aAuthorCompany);
|
||||||
|
$aWhere['company'] = ['not in', $aAuthorCompany];
|
||||||
|
}
|
||||||
if(!empty($aBlack) && !empty($aParam['not_choose_id'])){
|
if(!empty($aBlack) && !empty($aParam['not_choose_id'])){
|
||||||
$aBlack = array_unique(array_merge($aBlack, $aParam['not_choose_id']));
|
$aBlack = array_unique(array_merge($aBlack, $aParam['not_choose_id']));
|
||||||
$aWhere['reviewer_id'] = ['not in',$aBlack];
|
$aWhere['reviewer_id'] = ['not in',$aBlack];
|
||||||
@@ -229,6 +245,10 @@ class Reviewer
|
|||||||
't_user.state' => 0,
|
't_user.state' => 0,
|
||||||
't_user.user_id' => ['<>', $aArticle['user_id']]
|
't_user.user_id' => ['<>', $aArticle['user_id']]
|
||||||
];
|
];
|
||||||
|
if(!empty($aAuthorId)){
|
||||||
|
array_push($aAuthorId, $aArticle['user_id']);
|
||||||
|
$aWhere['t_user.user_id'] = ['not in', $aAuthorId];
|
||||||
|
}
|
||||||
//根据邮箱检索
|
//根据邮箱检索
|
||||||
if(!empty($aParam['email'])){
|
if(!empty($aParam['email'])){
|
||||||
$aWhere['t_user.email'] = ['like',"%" . $aParam["email"] . "%"];
|
$aWhere['t_user.email'] = ['like',"%" . $aParam["email"] . "%"];
|
||||||
@@ -242,7 +262,6 @@ class Reviewer
|
|||||||
->join('t_user', 't_user.user_id = t_reviewer_to_journal.reviewer_id')
|
->join('t_user', 't_user.user_id = t_reviewer_to_journal.reviewer_id')
|
||||||
->join(Db::raw("({$sMajorQuery}) major"),'major.user_id = t_reviewer_to_journal.reviewer_id')
|
->join(Db::raw("({$sMajorQuery}) major"),'major.user_id = t_reviewer_to_journal.reviewer_id')
|
||||||
->join(Db::raw("({$sCompanyQuery}) company"),'company.reviewer_id = t_reviewer_to_journal.reviewer_id')->where($aWhere)->group($sGroup)->count();
|
->join(Db::raw("({$sCompanyQuery}) company"),'company.reviewer_id = t_reviewer_to_journal.reviewer_id')->where($aWhere)->group($sGroup)->count();
|
||||||
|
|
||||||
if(empty($iCount)){
|
if(empty($iCount)){
|
||||||
return json_encode(['status' => 1,'msg' => 'No reviewer data found that meets the criteria','data' => ['total' => 0,'lists' => [],'size' => $iSize]]);
|
return json_encode(['status' => 1,'msg' => 'No reviewer data found that meets the criteria','data' => ['total' => 0,'lists' => [],'size' => $iSize]]);
|
||||||
}
|
}
|
||||||
@@ -349,21 +368,25 @@ class Reviewer
|
|||||||
if(empty($iArticleId)){
|
if(empty($iArticleId)){
|
||||||
return json_encode(['status' => 2,'msg' => 'Please select the article to query']);
|
return json_encode(['status' => 2,'msg' => 'Please select the article to query']);
|
||||||
}
|
}
|
||||||
//用户ID
|
|
||||||
$iUserId = empty($aParam['user_id']) ? 0 : $aParam['user_id'];
|
|
||||||
if(empty($iUserId)){
|
|
||||||
return json_encode(['status' => 2,'msg' => 'User ID cannot be empty']);
|
|
||||||
}
|
|
||||||
|
|
||||||
//查询文章作者详情 作者和审稿人的机构不一致
|
//查询文章作者
|
||||||
$aUserInfo = Db::name('user')->field('email')->where('user_id',$iUserId)->find();
|
$iUserId = empty($aParam['user_id']) ? 0 : $aParam['user_id'];
|
||||||
$sEmail = empty($aUserInfo['email']) ? '' : $aUserInfo['email'];
|
$aUserId = [$iUserId];
|
||||||
if(empty($sEmail)){
|
$aAuthorList = Db::name('article_author')->field('email,company')->where(['article_id'=>$iArticleId,'state' => 0])->select();
|
||||||
return json_encode(['status' => 3,'msg' => 'No user information found']);
|
if(!empty($aAuthorList)){
|
||||||
|
$aAuthorEmail = array_column($aAuthorList, 'email');
|
||||||
|
$aWhere = ['email' => ['in',$aAuthorEmail],'state' => 0];
|
||||||
|
$aUserId = Db::name('user')->where($aWhere)->column('user_id');
|
||||||
|
if(!empty($aUserId)){
|
||||||
|
array_push($aUserId, $iUserId);
|
||||||
}
|
}
|
||||||
//查询和作者同机构的审稿人
|
}
|
||||||
$aAuthor = Db::name('article_author')->field('company')->where(['article_id'=>$iArticleId,'email' => $sEmail,'state' => 0])->find();
|
//查询提交文章作者详情 作者和审稿人的机构不一致
|
||||||
return json_encode(['status' => 1,'msg' => 'success','data' => empty($aAuthor['company']) ? '' : $aAuthor['company']]);
|
if(!empty($aUserId)){
|
||||||
|
//作者同机构的审稿人
|
||||||
|
$aAuthorCompany = Db::name('user_reviewer_info')->where(['reviewer_id' => ['in',$aUserId],'state' => 0])->column('reviewer_id,company');
|
||||||
|
}
|
||||||
|
return json_encode(['status' => 1,'msg' => 'success','data' => ['company' => empty($aAuthorCompany[$iUserId]) ? '' : $aAuthorCompany[$iUserId],'user_id' => $aUserId,'author' => $aAuthorList,'company_list' => $aAuthorCompany]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -384,6 +407,23 @@ class Reviewer
|
|||||||
return json_encode(['status' => 2,'msg' => 'Reviewers who meet the criteria of the article were not selected']);
|
return json_encode(['status' => 2,'msg' => 'Reviewers who meet the criteria of the article were not selected']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//查询送审中的文章
|
||||||
|
$aWhere = ['state' => 2,'article_id' => $iArticleId];
|
||||||
|
$aArticle = Db::name('article')->field('article_id,user_id')->where($aWhere)->find();
|
||||||
|
if(empty($aArticle)){
|
||||||
|
return json_encode(array('status' => 3,'msg' => 'No articles requiring review were found' ));
|
||||||
|
}
|
||||||
|
//查询文章作者
|
||||||
|
$iArticleUserId = empty($aArticle['user_id']) ? 0 : $aArticle['user_id'];
|
||||||
|
$aAuthorId = [$iArticleUserId];
|
||||||
|
$aAuthorEmail = Db::name('article_author')->where(['article_id'=>$iArticleId,'state' => 0])->column('email');
|
||||||
|
if(!empty($aAuthorEmail)){
|
||||||
|
$aWhere = ['email' => ['in',$aAuthorEmail],'state' => 0];
|
||||||
|
$aAuthorId = Db::name('user')->where($aWhere)->column('user_id');
|
||||||
|
if(!empty($aAuthorId)){
|
||||||
|
array_push($aAuthorId, $iArticleUserId);
|
||||||
|
}
|
||||||
|
}
|
||||||
//查询文章审稿人是否存在
|
//查询文章审稿人是否存在
|
||||||
$aWhere = ['reviewer_id' => is_array($aReviewerId) ? ['in',$aReviewerId] : $aReviewerId,'article_id' => $iArticleId];
|
$aWhere = ['reviewer_id' => is_array($aReviewerId) ? ['in',$aReviewerId] : $aReviewerId,'article_id' => $iArticleId];
|
||||||
$aReviewer = Db::name('article_reviewer')->where($aWhere)->column('reviewer_id');
|
$aReviewer = Db::name('article_reviewer')->where($aWhere)->column('reviewer_id');
|
||||||
@@ -392,6 +432,9 @@ class Reviewer
|
|||||||
$aInsert = [];
|
$aInsert = [];
|
||||||
$iNowTime = time();
|
$iNowTime = time();
|
||||||
foreach ($aReviewerId as $value) {
|
foreach ($aReviewerId as $value) {
|
||||||
|
if(in_array($value, $aAuthorId)){//排除提交稿件作者跟文章作者
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if(in_array($value, $aReviewer)){
|
if(in_array($value, $aReviewer)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -458,6 +501,17 @@ class Reviewer
|
|||||||
return json_encode(['status' => 6,'msg' => 'No qualified reviewers were found']);
|
return json_encode(['status' => 6,'msg' => 'No qualified reviewers were found']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//查询文章作者
|
||||||
|
$iArticleUserId = empty($aArticle['user_id']) ? 0 : $aArticle['user_id'];
|
||||||
|
$aAuthorId = [$iArticleUserId];
|
||||||
|
$aAuthorEmail = Db::name('article_author')->where(['article_id'=>$iArticleId,'state' => 0])->column('email');
|
||||||
|
if(!empty($aAuthorEmail)){
|
||||||
|
$aWhere = ['email' => ['in',$aAuthorEmail],'state' => 0];
|
||||||
|
$aAuthorId = Db::name('user')->where($aWhere)->column('user_id');
|
||||||
|
if(!empty($aAuthorId)){
|
||||||
|
array_push($aAuthorId, $iArticleUserId);
|
||||||
|
}
|
||||||
|
}
|
||||||
//查询用户邮箱
|
//查询用户邮箱
|
||||||
$aUserId = array_keys($aReviewer);
|
$aUserId = array_keys($aReviewer);
|
||||||
$aWhere = ['user_id' => ['in',$aUserId],'state' => 0,'email' => ['<>','']];
|
$aWhere = ['user_id' => ['in',$aUserId],'state' => 0,'email' => ['<>','']];
|
||||||
@@ -484,7 +538,9 @@ class Reviewer
|
|||||||
$oArticle = new \app\api\controller\Article;
|
$oArticle = new \app\api\controller\Article;
|
||||||
$sMsg = '';
|
$sMsg = '';
|
||||||
foreach ($aUser as $key => $value) {
|
foreach ($aUser as $key => $value) {
|
||||||
|
if(in_array($value['user_id'], $aAuthorId)){//排除提交稿件作者跟文章作者
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$email = empty($value['email']) ? '' : $value['email'];
|
$email = empty($value['email']) ? '' : $value['email'];
|
||||||
if(empty($email) || empty($aReviewer[$value['user_id']])){
|
if(empty($email) || empty($aReviewer[$value['user_id']])){
|
||||||
continue;
|
continue;
|
||||||
@@ -557,7 +613,8 @@ class Reviewer
|
|||||||
//判断文章最新邀请审稿时间判断是否超过七日
|
//判断文章最新邀请审稿时间判断是否超过七日
|
||||||
$iDay = 7;
|
$iDay = 7;
|
||||||
$sDate = strtotime('-'.$iDay.' day');
|
$sDate = strtotime('-'.$iDay.' day');
|
||||||
$iMaxTime = DB::name('article_reviewer')->where($aWhere)->max('invited_time');
|
$aCountWhere = ['article_id' => $aParam['article_id'],'state' => ['<>',4]];
|
||||||
|
$iMaxTime = DB::name('article_reviewer')->where($aCountWhere)->max('invited_time');
|
||||||
$iMaxTime = empty($iMaxTime) ? 0 : $iMaxTime;
|
$iMaxTime = empty($iMaxTime) ? 0 : $iMaxTime;
|
||||||
if($iMaxTime > $sDate){
|
if($iMaxTime > $sDate){
|
||||||
return json_encode(['status' => 4,'msg' => 'The last invitation for reviewers did not exceed '.$iDay.' days']);
|
return json_encode(['status' => 4,'msg' => 'The last invitation for reviewers did not exceed '.$iDay.' days']);
|
||||||
|
|||||||
Reference in New Issue
Block a user