diff --git a/application/admin/controllers/StatController.php b/application/admin/controllers/StatController.php index 4fa24839..36c11fb1 100644 --- a/application/admin/controllers/StatController.php +++ b/application/admin/controllers/StatController.php @@ -9,6 +9,7 @@ class Admin_StatController extends Zend_Controller_Action $this->view->messages = $this->messenger->getMessages(); $this->view->theme = new Theme(); $this->_helper->layout->setLayout('administry'); + $this->submd=$this->view->config->sub->metadata; } function postDispatch() { @@ -17,27 +18,27 @@ class Admin_StatController extends Zend_Controller_Action function indexAction() { $sql="select (select count(id) from users) as alluser, - (select count(id) from normalmetadata) as alldata, - (select count(id) as num from dataorder where status=0) as onlinedown, - (select count(id) as num from dataorder where status=5) as offlinedown, - (select count(id) as num from offlineapp where ts_approved is not null) as offlinepass, - (select count(id) as num from offlineapp where ts_approved is null) as offlineunfinished, - (select count(id) as num from dataorder where offlineappid>0 and status=-1) as offlinedenied, - (select count(id) as num from onlineapp) as onlineapp"; + (select count(id) from $this->submd) as alldata, + (select count(id) as num from dataorder where status=0 and uuid in (select uuid from $this->submd)) as onlinedown, + (select count(id) as num from dataorder where status=5 and uuid in (select uuid from $this->submd)) as offlinedown, + (select count(id) as num from offlineapp where ts_approved is not null and id in (select offlineappid from dataorder where uuid in (select uuid from $this->submd))) as offlinepass, + (select count(id) as num from offlineapp where ts_approved is null and id in (select offlineappid from dataorder where uuid in (select uuid from $this->submd))) as offlineunfinished, + (select count(id) as num from dataorder where offlineappid>0 and status=-1 and uuid in (select uuid from $this->submd)) as offlinedenied, + (select count(id) as num from onlineapp and id in (select onlineappid from dataorder where uuid in (select uuid from $this->submd))) as onlineapp"; $this->view->stat=$this->db->fetchRow($sql); //下载量统计 - $sql = "select sum(num) as num from (select m.filesize/1024 as num,m.title,d.userid from dataorder d left join metadata m on d.uuid=m.uuid where (d.status=0 or d.status=5) and m.filesize>0 group by m.title,d.userid,m.filesize) as t"; + $sql = "select sum(num) as num from (select m.filesize/1024 as num,m.title,d.userid from dataorder d left join $this->submd m on d.uuid=m.uuid where (d.status=0 or d.status=5) and m.filesize>0 group by m.title,d.userid,m.filesize) as t"; $res = $this->db->query($sql); $allsize = $res->fetch(); $this->view->allsize = $allsize; - $sql = "select sum(num) as num from (select m.filesize/1024 as num,m.title,d.userid from dataorder d left join metadata m on d.uuid=m.uuid where d.status=5 and m.filesize>0 group by m.title,d.userid,m.filesize) as t"; + $sql = "select sum(num) as num from (select m.filesize/1024 as num,m.title,d.userid from dataorder d left join $this->submd m on d.uuid=m.uuid where d.status=5 and m.filesize>0 group by m.title,d.userid,m.filesize) as t"; $res = $this->db->query($sql); $offlinesize = $res->fetch(); $this->view->offlinesize = $offlinesize; - $sql = "select sum(num) as num from (select m.filesize/1024 as num,m.title,d.userid from dataorder d left join metadata m on d.uuid=m.uuid where d.status=0 and m.filesize>0 group by m.title,d.userid,m.filesize) as t"; + $sql = "select sum(num) as num from (select m.filesize/1024 as num,m.title,d.userid from dataorder d left join $this->submd m on d.uuid=m.uuid where d.status=0 and m.filesize>0 group by m.title,d.userid,m.filesize) as t"; $res = $this->db->query($sql); $onlinesize = $res->fetch(); $this->view->onlinesize = $onlinesize; @@ -65,7 +66,7 @@ class Admin_StatController extends Zend_Controller_Action where d.offlineappid>0 and o.unit is not null and d.status>4";*/ //各单位下载情况,统计的离线申请数据次数 $sql = "select count(o.id) as num,o.unit from offlineapp o - where o.unit is not null "; + where o.unit is not null and o.id in (select offlineappid from dataorder where uuid in (select uuid from $this->submd))"; if ($y) $sql.=" and extract(year from o.ts_created)='$y'"; $sql.=" group by o.unit"; @@ -75,7 +76,8 @@ class Admin_StatController extends Zend_Controller_Action //各单位在线下载情况 $sql = "select count(d.id) as num,o.unit from dataorder d left join onlineapp o on o.id=d.onlineappid - where d.onlineappid>0 and o.unit is not null"; + where d.onlineappid>0 and o.unit is not null + and d.uuid in (select uuid from $this->submd)"; if ($y) $sql.=" and extract(year from o.ts_created)='$y'"; $sql.=" group by o.unit"; diff --git a/application/admin/views/scripts/header.phtml b/application/admin/views/scripts/header.phtml index 7ca42de5..dad9ff81 100755 --- a/application/admin/views/scripts/header.phtml +++ b/application/admin/views/scripts/header.phtml @@ -12,7 +12,6 @@