diff --git a/application/api/controller/Finalreview.php b/application/api/controller/Finalreview.php index 7d1d2d2..bbb57a8 100644 --- a/application/api/controller/Finalreview.php +++ b/application/api/controller/Finalreview.php @@ -1081,15 +1081,17 @@ class Finalreview extends Base $aQuestion = empty($aQuestion) ? [] : array_column($aQuestion, null,'art_rev_id'); //查询复审 - $aReviewerRepeatLists = []; - $aWhere = ['art_rev_id' => ['in',$aArtRevId],'recommend' => ['between',[1,3]]]; - $aReviewerRepeat = Db::name('article_reviewer_repeat')->field('art_rev_rep_id,art_rev_id,recommend,ctime,stime')->where($aWhere)->select(); + $aReviewerRepeatLists = $aReviewerRepeatListsData = []; + $aWhere = ['art_rev_id' => ['in',$aArtRevId],'recommend' => ['between',[0,3]]]; + $aReviewerRepeat = Db::name('article_reviewer_repeat')->field('art_rev_rep_id,art_rev_id,recommend,ctime,stime,state')->where($aWhere)->select(); if(!empty($aReviewerRepeat)){ foreach ($aReviewerRepeat as $key => $value) { - $aReviewerRepeatLists[$value['art_rev_id']][] = $value; + if(in_array($value['recommend'], [1,2,3])){ + $aReviewerRepeatLists[$value['art_rev_id']][] = $value; + } + $aReviewerRepeatListsData[$value['art_rev_id']][] = $value; } } - //查询作者信息 $aUserId = array_unique(array_column($aArticleReviewer, 'reviewer_id')); $aWhere = ['user_id' => ['in',$aUserId],'state' => 0]; @@ -1100,6 +1102,18 @@ class Finalreview extends Base $value['ctime'] = empty($aQuestionData['ctime']) ? $value['ctime'] : $aQuestionData['ctime']; $value['score'] = empty($aQuestionData['score']) ? 0 : $aQuestionData['score']; $value['repeat'] = empty($aReviewerRepeatLists[$value['art_rev_id']]) ? [] : $aReviewerRepeatLists[$value['art_rev_id']]; + //判断是否复审 + $value['can_repeat'] = empty($aQuestionData) ? 0 : 1; + if(!empty($aReviewerRepeatListsData[$value['art_rev_id']])){ + $aEnd = end($aReviewerRepeatListsData[$value['art_rev_id']]); + $iState = empty($aEnd['state']) ? 0 : $aEnd['state']; + $iRecommend = empty($aEnd['recommend']) ? 0 : $aEnd['recommend']; + if($iState == 1 && $iRecommend == 3){ + $value['can_repeat'] = 1; + }else{ + $value['can_repeat'] = 0; + } + } $value['rated'] = empty($aQuestionData['rated']) ? 0 : $aQuestionData['rated']; $value['realname'] = empty($aUser[$value['reviewer_id']]) ? '' : $aUser[$value['reviewer_id']]; $value['recommend'] = empty($aQuestionData['recommend']) ? 0 : $aQuestionData['recommend']; diff --git a/application/api/controller/Preaccept.php b/application/api/controller/Preaccept.php index 178a6ac..ae646ed 100644 --- a/application/api/controller/Preaccept.php +++ b/application/api/controller/Preaccept.php @@ -1713,23 +1713,30 @@ return null; } //查询参考文献数据 $aWhere = ['p_article_id' => $iPArticleId,'article_id' => $iArticleId,'state' => 0]; - $iCount = Db::name('production_article_refer')->where($aWhere)->count(); - if(empty($iCount)){ + $aRefer = Db::name('production_article_refer')->where($aWhere)->select(); + if(empty($aRefer)){ return json_encode(array('status' => 3,'msg' => 'Reference is empty','data' => ['total' => 0,'unprocessed_total' => 0,'processed_total' => 0])); } - //获取未处理的数据 - $aWhere['is_deal'] = 2; - $aUnprocessed = Db::name('production_article_refer')->where($aWhere)->select(); - //获取已处理的数据 - $aWhere['is_deal'] = 1; - $aProcessed = Db::name('production_article_refer')->where($aWhere)->select(); - //未处理的数量 - $iUnprocessed = empty($aUnprocessed) ? 0 : count($aUnprocessed); - //已处理的数量 - $iProcessed = empty($aProcessed) ? 0 : count($aProcessed); - - //数据组合 - $aRefer = array_merge($aUnprocessed,$aProcessed); + //获取总数量 + $iCount = empty($aRefer) ? 0 : count($aRefer); + $aWhere["refer_doi"] = ["<>",""]; + $aDoi = Db::name('production_article_refer')->field('count(p_article_id) as num,refer_doi')->where($aWhere)->group('refer_doi')->select(); + $aDoi = empty($aDoi) ? [] : array_column($aDoi, 'num','refer_doi'); + //数据处理 + $iUnprocessed = $iProcessed = 0; + foreach ($aRefer as $key => $value) { + if($value['is_deal'] == 1){ + $iProcessed++; + } + if($value['is_deal'] == 2){ + $iUnprocessed++; + } + $iIsRepat = 0; + if(!empty($value['refer_doi']) && (!empty($aDoi[$value['refer_doi']]) && $aDoi[$value['refer_doi']] > 1)){ + $iIsRepat = 1; + } + $aRefer[$key]['is_repeat'] = $iIsRepat; + } $aRefer = ['total' => $iCount,'unprocessed_total' => $iUnprocessed,'processed_total' => $iProcessed,'refer' => $aRefer]; return json_encode(['status' => 1,'msg' => 'success','data' => $aRefer]); } @@ -1749,10 +1756,10 @@ return null; if(empty($aArticle)){ return jsonError('No article information found'); } - $iIsBuy = empty($aArticle['is_buy']) ? 0 : $aArticle['is_buy']; - if($iIsBuy != 1){ - return jsonError('Article unpaid'); - } + // $iIsBuy = empty($aArticle['is_buy']) ? 0 : $aArticle['is_buy']; + // if($iIsBuy != 1){ + // return jsonError('Article unpaid'); + // } $aWhere = ['article_id' => $iArticleId,'state' => 0]; $aProductionArticle = $this->production_article_obj->field('p_article_id')->where($aWhere)->find(); if(!empty($aProductionArticle)) {