From 3945681a95af2614d233ed089140eb3532ba9165 Mon Sep 17 00:00:00 2001 From: wangjinlei <751475802@qq.com> Date: Fri, 20 Oct 2023 13:54:26 +0800 Subject: [PATCH] 1 --- application/api/controller/Monitor.php | 33 ++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/application/api/controller/Monitor.php b/application/api/controller/Monitor.php index 1b74d28..7961437 100644 --- a/application/api/controller/Monitor.php +++ b/application/api/controller/Monitor.php @@ -133,6 +133,10 @@ class Monitor extends Base $are = $this->getZT($v['journal_id'],date("Y-m")); $journals[$k]['Z'] = $are['z']; $journals[$k]['ZT'] = $are['zt']; + //当年分数总结 + $dn = $this->getDN($v['journal_id'],date("Y")); + $journals[$k]['ZS'] = $dn['zs']; + $journals[$k]['CS'] = $dn['cs']; } $re['journals'] = $journals; @@ -185,6 +189,35 @@ class Monitor extends Base } + private function getDN($journal_id,$y){ + $start = strtotime(date($y.'-01-01 00:00:00')); + $articles = $this->article_obj->where("journal_id",$journal_id)->where("rtime",">",$start)->where("state",5)->select(); + $zs = 0; + $cs = 0; + foreach ($articles as $k => $v){ + $revs = $this->article_reviewer_obj + ->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',$v['article_id'])->where('t_article_reviewer.state',"in",[1,2,3])->select(); + $num = 0; + foreach ($revs as $val){ + $num += $val['rated']; + } + $articles[$k]['reviewer_fen'] = count($revs)==0?0:$num/count($revs); + $last_fen = ($v['scoring']+$articles[$k]['reviewer_fen'])/2 ; + $cs += round($v['scoring'],1); + $zs += round($last_fen,1); + } + if(count($articles)>0){ + $re['cs'] = round($cs/count($articles),1); + $re['zs'] = round($zs/count($articles),1); + }else{ + $re['cs'] = 0; + $re['zs'] = 0; + } + return $re; + } + + private function getDY($journal_id,$ym){ $start = strtotime(date($ym.'-01 00:00:00')); $articles = $this->article_obj->where("journal_id",$journal_id)->where("rtime",">",$start)->where("state",5)->select();