From fd29805454d30044f3d47cd24fe15c81b67ffd85 Mon Sep 17 00:00:00 2001 From: chengxl Date: Thu, 25 Dec 2025 15:53:35 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=AE=A1=E7=A8=BF=E4=BA=BA=E6=8E=A8?= =?UTF-8?q?=E8=8D=90=E4=BD=9C=E8=80=85=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common/Reviewer.php | 91 +++++++++++++++++++++++++++------ 1 file changed, 74 insertions(+), 17 deletions(-) diff --git a/application/common/Reviewer.php b/application/common/Reviewer.php index 78247aa..e33923a 100644 --- a/application/common/Reviewer.php +++ b/application/common/Reviewer.php @@ -183,7 +183,18 @@ class Reviewer } //查询作者所属机构 $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 = empty($aBlack['data']) ? [] : $aBlack['data']; @@ -200,6 +211,11 @@ class Reviewer // 查询符合公司条件的审稿人ID,确保去重 $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'])){ $aBlack = array_unique(array_merge($aBlack, $aParam['not_choose_id'])); $aWhere['reviewer_id'] = ['not in',$aBlack]; @@ -229,6 +245,10 @@ class Reviewer 't_user.state' => 0, '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'])){ $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(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(); - if(empty($iCount)){ 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)){ 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(); - $sEmail = empty($aUserInfo['email']) ? '' : $aUserInfo['email']; - if(empty($sEmail)){ - return json_encode(['status' => 3,'msg' => 'No user information found']); + //查询文章作者 + $iUserId = empty($aParam['user_id']) ? 0 : $aParam['user_id']; + $aUserId = [$iUserId]; + $aAuthorList = Db::name('article_author')->field('email,company')->where(['article_id'=>$iArticleId,'state' => 0])->select(); + 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']); } + //查询送审中的文章 + $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]; $aReviewer = Db::name('article_reviewer')->where($aWhere)->column('reviewer_id'); @@ -392,6 +432,9 @@ class Reviewer $aInsert = []; $iNowTime = time(); foreach ($aReviewerId as $value) { + if(in_array($value, $aAuthorId)){//排除提交稿件作者跟文章作者 + continue; + } if(in_array($value, $aReviewer)){ continue; } @@ -458,6 +501,17 @@ class Reviewer 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); $aWhere = ['user_id' => ['in',$aUserId],'state' => 0,'email' => ['<>','']]; @@ -484,7 +538,9 @@ class Reviewer $oArticle = new \app\api\controller\Article; $sMsg = ''; foreach ($aUser as $key => $value) { - + if(in_array($value['user_id'], $aAuthorId)){//排除提交稿件作者跟文章作者 + continue; + } $email = empty($value['email']) ? '' : $value['email']; if(empty($email) || empty($aReviewer[$value['user_id']])){ continue; @@ -557,7 +613,8 @@ class Reviewer //判断文章最新邀请审稿时间判断是否超过七日 $iDay = 7; $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; if($iMaxTime > $sDate){ return json_encode(['status' => 4,'msg' => 'The last invitation for reviewers did not exceed '.$iDay.' days']); From 18f6608ceacfd429ec4af5594f3f599d8eaeaa6e Mon Sep 17 00:00:00 2001 From: chengxl Date: Thu, 25 Dec 2025 17:22:27 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/controller/Reviewer.php | 32 +++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/application/api/controller/Reviewer.php b/application/api/controller/Reviewer.php index 2977393..5056475 100644 --- a/application/api/controller/Reviewer.php +++ b/application/api/controller/Reviewer.php @@ -2224,12 +2224,36 @@ class Reviewer extends Base } //查询文章期刊ID - $article_info = $this->article_obj->field('journal_id')->where("article_id", $data['article_id'])->find(); + $article_info = $this->article_obj->field('user_id,journal_id')->where("article_id", $data['article_id'])->find(); + //查询文章作者 + $iUserId = empty($article_info['user_id']) ? 0 : $article_info['user_id']; + $aUserId = [$iUserId]; + $article_info = $this->article_obj->field('user_id,journal_id')->where("article_id", $data['article_id'])->find(); + $aAuthorList = Db::name('article_author')->field('email,company')->where(['article_id'=>$data['article_id'],'state' => 0])->select(); + 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); + } + } + //查询提交文章作者详情 作者和审稿人的机构不一致 + $aReviewerCompany = []; + if(!empty($aUserId)){ + //作者同机构的审稿人 + $aReviewerCompany = Db::name('user_reviewer_info')->where(['reviewer_id' => ['in',$aUserId],'state' => 0])->column('reviewer_id,company'); + } + + //文章作者机构信息 + $aAuthorCompany = empty($aAuthorList) ? [] : array_unique(array_column($aAuthorList, 'company')); + $aAuthorCompany = array_unique(array_merge($aAuthorCompany,$aReviewerCompany)); //期刊ID $iJournalId = empty($article_info['journal_id']) ? 0 : $article_info['journal_id']; //查询文章现有审稿人 $noids = $this->article_reviewer_obj->where('article_id', $data['article_id'])->column('reviewer_id'); - + $noids = empty($noids) ? [] : $noids; + $noids = empty($aUserId) ? $noids : array_unique(array_merge($aUserId,$noids)); //分页配置 $limit_start = ($data['pageIndex'] - 1) * $data['pageSize']; @@ -2251,6 +2275,10 @@ class Reviewer extends Base $where['t_user_reviewer_info.major'] = ['in',$this->majorids($data['major_id'])]; } + //过滤审稿人机构 + if(!empty($aAuthorCompany)){ + $where['t_user_reviewer_info.company'] = ['not in', $aAuthorCompany]; + } // 计算10天之后的时间戳(10天 = 10 * 24 * 60 * 60秒) $iTeenDaysLater = strtotime('-10 days'); From 66f963c7aa92fcf6da238c4070c6943090ae2e80 Mon Sep 17 00:00:00 2001 From: chengxl Date: Mon, 29 Dec 2025 14:05:49 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=97=B6=E9=97=B4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/controller/Workbench.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/application/api/controller/Workbench.php b/application/api/controller/Workbench.php index ec06353..0d8bf45 100644 --- a/application/api/controller/Workbench.php +++ b/application/api/controller/Workbench.php @@ -506,8 +506,8 @@ class Workbench extends Base } $aArticle['type_name'] = translateType($aArticle['type']);//文章类型 //查询期刊信息 - $aWhere = ['journal_id' => $aArticle['article_id'],'state' => 0]; - $aJournal = Db::name('journal')->field('title as journal_name,website,email as journal_email')->find(); + $aWhere = ['journal_id' => $aArticle['journal_id'],'state' => 0]; + $aJournal = Db::name('journal')->field('title as journal_name,website,email as journal_email')->where($aWhere)->find(); if(!empty($aJournal)){ $aArticle += $aJournal; } @@ -551,7 +551,8 @@ class Workbench extends Base $iIsCode = 1; } //当前时间 - $iNowTime = time(); + // $iNowTime = time(); + $iNowTime = strtotime(date('Y-m-d', time())); // 14天 = 14*24*3600 秒 = 1209600 秒 $iFourteenDays = 14 * 24 * 3600; //五天 @@ -569,6 +570,8 @@ class Workbench extends Base ]); } //判断是否超过5天 + $iTime = date('Y-m-d', $iTime); + $iTime = strtotime($iTime);//邀请时间戳 $timeDiff = $iTime+$iFiveDays; if($timeDiff < $iNowTime){ //执行审稿过期 @@ -600,6 +603,8 @@ class Workbench extends Base ]); } //判断是否超过14天 + $iTime = date('Y-m-d', $iTime); + $iTime = strtotime($iTime);//同意审稿时间戳 $timeDiff = $iTime+$iFourteenDays; if($timeDiff < $iNowTime){ return json_encode(['status' => 16,'msg' => 'The number of days for agreeing to review has exceeded 14','data' => $aData]);