From e66cd277145c28dcece4d9f0add610a1e0967460 Mon Sep 17 00:00:00 2001 From: wangjinlei <751475802@qq.com> Date: Fri, 13 Oct 2023 14:01:12 +0800 Subject: [PATCH] 1 --- application/api/controller/Monitor.php | 66 ++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/application/api/controller/Monitor.php b/application/api/controller/Monitor.php index 5577a62..9a1068e 100644 --- a/application/api/controller/Monitor.php +++ b/application/api/controller/Monitor.php @@ -117,6 +117,28 @@ class Monitor extends Base return jsonSuccess($re); } + /**获取期刊总结报表 + * @return void + */ + public function getJournalForms(){ + $journals = $this->journal_obj->where('state',0)->order("editor_id")->select(); + foreach ($journals as $k => $v){ + //编辑信息 + $journals[$k]['editor'] = $this->user_obj->where('user_id',$v['editor_id'])->find(); + //当月点数 + $aaa = $this->getDY($v['journal_id'],date("Y-m")); + $journals[$k]['DY'] = round($aaa['fen'],1) ; + $journals[$k]['mx'] = $aaa['mx']; + //获取当月直投量 + $are = $this->getZT($v['journal_id'],date("Y-m")); + $journals[$k]['Z'] = $are['z']; + $journals[$k]['ZT'] = $are['zt']; + } + + $re['journals'] = $journals; + return jsonSuccess($re); + } + /**获取期刊青年科学家列表 * @return void */ @@ -153,4 +175,48 @@ class Monitor extends Base return jsonSuccess($re); } + + public function ttt(){ + $res = $this->getDY(22,date("Y-m")); + echo "
"; + var_dump($res); + echo ""; + die; + } + + + 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(); + $dy = 0; + $mx = []; + 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 ; + $mx[] = $v['accept_sn'].":".$last_fen; + $dy += $last_fen; + } + $re['fen'] = $dy; + $re['mx'] = $mx; + return $re; + } + + + private function getZT($journal_id,$ym){ + $start = strtotime(date($ym.'-01 00:00:00')); + $journal_info = $this->journal_obj->where('journal_id',$journal_id)->find(); + $articles = $this->article_obj->where('accept_sn',"like",$journal_info['abbr']."%")->where('ctime',">",$start)->select(); + + $zt_articles = $this->article_obj->where('accept_sn',"not like",$journal_info['abbr']."%")->where('ctime',">",$start)->where('journal_id',$journal_id)->select(); + $re['zt'] =count($zt_articles); + $re['z'] = count($articles); + return $re; + } } \ No newline at end of file