Ticket #192 在water项目统计中添加按月统计的下载量

This commit is contained in:
Li Jianxuan 2011-09-30 06:56:24 +00:00
parent 35bfe01f73
commit 74d38052e0
2 changed files with 40 additions and 2 deletions

View File

@ -82,19 +82,23 @@ class Admin_StatController extends Zend_Controller_Action
$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";
$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";
$res = $this->db->query($sql);
$onlinesize = $res->fetch();
$this->view->onlinesize = $onlinesize;
$sql="select sum(configvalue::real)/1024/1024/1024 as num from g6ftpusersettings where userid in (select id from g6ftpusers where name like 'westdc%' or name='newwestdc') and configname='StatsDownloaded'";
$res = $this->db->query($sql);
$onlinesize = $res->fetch();
$this->view->onlineg6size = $onlinesize;
}//indexAction 首页
function awstatswebAction()
@ -184,6 +188,17 @@ class Admin_StatController extends Zend_Controller_Action
$this->view->ounit = $ounit;
//water 项目按月统计下载量
$sql = "select (sum(m.filesize)/1024) as n,extract(month from d.ts_created) as m,extract(year from d.ts_created) as y from dataorder d left join metadata m on d.uuid=m.uuid
where d.status=5 and m.source='0595169a-279e-4b95-819f-129d0ba4280d'
group by extract(month from d.ts_created),extract(year from d.ts_created)
order by extract(year from d.ts_created),extract(month from d.ts_created)";
$re = $this->db->query($sql);
$dm = $re->fetchAll();
$this->view->dm = $dm;
}//WATER项目

View File

@ -84,6 +84,29 @@
</table>
</div>
<div class="tables">
<div class="stitle">按月统计下载量</div>
<table>
<thead>
<tr>
<td width="100"></td>
<td width="100"></td>
<td width="100">下载量</td>
</tr>
</thead>
<?php
foreach($this->dm as $k=>$v)
{
echo '<tr>
<td>'.$v['y'].'</td>
<td>'.$v['m'].'</td>
<td>'.round($v['n'],3).' GB</td>
</tr>';
}
?>
</table>
</div>
<div class="tables">
<div class="stitle">服务总数据量</div>
<table>