diff --git a/application/admin/controllers/StatController.php b/application/admin/controllers/StatController.php index 29ee5fcb..2ff83419 100644 --- a/application/admin/controllers/StatController.php +++ b/application/admin/controllers/StatController.php @@ -78,15 +78,15 @@ class Admin_StatController extends Zend_Controller_Action $this->view->unitonline = $unitonline; //下载量统计 - $sql = "select (sum(m.filesize)/1024) as num from dataorder d left join metadata m on d.uuid=m.uuid"; + $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"; $res = $this->db->query($sql); $allsize = $res->fetch(); $this->view->allsize = $allsize; - $sql = "select (sum(m.filesize)/1024) as num from dataorder d left join metadata m on d.uuid=m.uuid where d.offlineappid>0"; + $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"; $res = $this->db->query($sql); $offlinesize = $res->fetch(); $this->view->offlinesize = $offlinesize; - $sql = "select (sum(m.filesize)/1024) as num from dataorder d left join metadata m on d.uuid=m.uuid where d.onlineappid>0"; + $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"; $res = $this->db->query($sql); $onlinesize = $res->fetch(); $this->view->onlinesize = $onlinesize;