From 582f7054ad5cade4b5a3bdec9690ba85d071f34f Mon Sep 17 00:00:00 2001 From: Li Jianxuan Date: Thu, 18 Dec 2014 06:47:57 +0000 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=AE=A1=E5=88=92=E5=86=85?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=9C=8D=E5=8A=A1=E6=83=85=E5=86=B5=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controllers/DataController.php | 23 +++-- .../views/scripts/data/project-status.phtml | 33 +++++++- application/models/Heihe.php | 84 +++++++++++++++++++ 3 files changed, 132 insertions(+), 8 deletions(-) diff --git a/application/admin/controllers/DataController.php b/application/admin/controllers/DataController.php index eb4c28d2..148c44e5 100755 --- a/application/admin/controllers/DataController.php +++ b/application/admin/controllers/DataController.php @@ -3780,10 +3780,6 @@ class Admin_DataController extends Zend_Controller_Action //统计 if($ac == 'status') { - $this->_helper->viewRenderer('project-status'); - - $this->view->projects = $heihe->fetch(); - $status = new \Heihe\Status; $fund_id = $this->_getParam('fund_id'); @@ -3795,6 +3791,17 @@ class Admin_DataController extends Zend_Controller_Action $status->fund_id = $fund_id; } + if(view::isXmlHttpRequest()) + { + echo $status->fileCount(); + exit(); + } + + $this->_helper->viewRenderer('project-status'); + + $this->view->projects = $heihe->fetch(); + + $this->view->projectsCount = $status->projectsCount(); $this->view->dataCount = $status->dataCount(); @@ -3807,7 +3814,13 @@ class Admin_DataController extends Zend_Controller_Action $this->view->applyTimesDistanct = $status->applyTimesDistinct(); - $this->view->fileCount = $status->fileCount(); + //$this->view->fileCount = $status->fileCount(); + + $this->view->offlineServiceTimes = $status->serviceTimes('offline'); + $this->view->onlineServiceTimes = $status->serviceTimes('online'); + + $this->view->offlineServiceSize = $status->serviceFilesize('offline'); + $this->view->onlineServiceSize = $status->serviceFilesize('online'); }//status diff --git a/application/admin/views/scripts/data/project-status.phtml b/application/admin/views/scripts/data/project-status.phtml index 15cc1ce0..68053b34 100644 --- a/application/admin/views/scripts/data/project-status.phtml +++ b/application/admin/views/scripts/data/project-status.phtml @@ -21,13 +21,23 @@

统计信息


+

数据:

项目个数:projectsCount ?>

数据条数:dataCount ?>

总数据量:dataFileSize / 1024 , 2) . 'GB' ?>

-

文件个数:fileCount ?>

+

文件个数:点击查看

服务次数(人/次):applyTimes ?>

服务次数(人/合并次,单个用户多次申请算作一次服务): applyTimesDistanct ?>

-

服务次数(人/数据):dataApplyTimes ?>

+

服务次数(数据条/次):dataApplyTimes ?>

+ + +

项目服务情况

+

为黑河计划项目服务的次数-离线:offlineServiceTimes ?>

+

为黑河计划项目服务的数据量-离线:offlineServiceSize,2) ?>GB

+

为黑河计划项目服务的次数-在线:onlineServiceTimes ?>

+

为黑河计划项目服务的数据量-在线:onlineServiceSize ,2) ?>GB

+

为黑河计划项目服务的次数-总数:onlineServiceTimes + $this->offlineServiceTimes ?>

+

为黑河计划项目服务的数据量-总数:onlineServiceSize + $this->offlineServiceSize ,2)?>GB

选择项目进行统计

@@ -44,4 +54,21 @@ - \ No newline at end of file + + + \ No newline at end of file diff --git a/application/models/Heihe.php b/application/models/Heihe.php index 1b538526..a0d9410f 100644 --- a/application/models/Heihe.php +++ b/application/models/Heihe.php @@ -572,4 +572,88 @@ class Status{ return $rs->fetchAll(); } + //为黑河计划项目服务的情况 + public function serviceTimes($type = "offline") + { + if($type == 'offline') + { + $arr = ['ts_approved IS NOT NULL']; + }else{ + $arr = []; + } + + $fund = $this->makeConditionFound("project_id"); + if(!empty($fund)) + { + $arr[] = $fund; + }else{ + $select = "SELECT DISTINCT code FROM heiheproject"; + + $rs = $this->db->query($select); + + $code_statck = []; + + while($row = $rs->fetch()) + { + $code_statck[] = $row['code']; + } + + $arr[] = " project_id IN ('".join("','" , $code_statck)."')"; + } + + $wheresql = $this->makeWhereSql($arr); + + + if($type == 'offline') + $sql = "SELECT count(id) FROM offlineapp $wheresql"; + else + $sql = "SELECT count(id) FROM onlineapp $wheresql"; + + $rs = $this->db->query($sql); + + return $rs->fetchColumn(0); + } + + + //服务数据大小 + public function serviceFilesize($type = "offline") + { + if($type == 'offline') + { + $arr = ['off.ts_approved IS NOT NULL']; + }else{ + $arr = []; + } + + $fund = $this->makeConditionFound("off.project_id"); + if(!empty($fund)) + { + $arr[] = $fund; + }else{ + $select = "SELECT DISTINCT code FROM heiheproject"; + + $rs = $this->db->query($select); + + $code_statck = []; + + while($row = $rs->fetch()) + { + $code_statck[] = $row['code']; + } + + $arr[] = " off.project_id IN ('".join("','" , $code_statck)."')"; + } + + $wheresql = $this->makeWhereSql($arr); + + $sql = "SELECT SUM(md.filesize) /1024 as size FROM metadata md + LEFT JOIN dataorder o ON o.uuid=md.uuid + LEFT JOIN offlineapp off ON off.id = o.offlineappid + $wheresql"; + + $rs = $this->db->query($sql); + + return $rs->fetchColumn(0); + } + }