剔除用户重复的数据下载量

This commit is contained in:
wlx 2011-09-24 13:39:02 +00:00
parent 85d9463729
commit bac94c2dc9
1 changed files with 3 additions and 3 deletions

View File

@ -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;