修复按月统计中的在线次数及离线申请数问题

This commit is contained in:
wlx 2011-12-23 03:45:04 +00:00
parent 9b54d85bd8
commit d3ceeb9aa1
2 changed files with 18 additions and 12 deletions

View File

@ -106,8 +106,10 @@ class Admin_StatController extends Zend_Controller_Action
}
$this->view->y = $y;
$sql = "select count(extract(month from ts_created)) as c,extract(month from ts_created) as m,extract(year from ts_created) as y from onlineapp
where extract(year from ts_created)='$y'
group by extract(month from ts_created),extract(year from ts_created)
where id in (select distinct(onlineappid) from dataorder)";
if ($y)
$sql.=" and extract(year from ts_created)='$y' ";
$sql.=" group by extract(month from ts_created),extract(year from ts_created)
order by extract(year from ts_created),extract(month from ts_created)";
$rs = $this->db->query($sql);
$rows = $rs->fetchAll();
@ -115,8 +117,10 @@ class Admin_StatController extends Zend_Controller_Action
$this->view->data = $rows;
$sql = "select count(extract(month from ts_created)) as c,extract(month from ts_created) as m,extract(year from ts_created) as y from offlineapp
where extract(year from ts_created)='$y'
group by extract(month from ts_created),extract(year from ts_created)
where ts_approved is not null";
if ($y)
$sql.=" and extract(year from ts_created)='$y' ";
$sql.=" group by extract(month from ts_created),extract(year from ts_created)
order by extract(year from ts_created),extract(month from ts_created)";
$rs = $this->db->query($sql);
$rows = $rs->fetchAll();
@ -128,9 +132,10 @@ class Admin_StatController extends Zend_Controller_Action
$this->view->offline = $rows;
$sql = "select count(extract(month from ts_created)) as c,extract(month from ts_created) as m,extract(year from ts_created) as y from users
where extract(year from ts_created)='$y'
group by extract(month from ts_created),extract(year from ts_created)
$sql = "select count(extract(month from ts_created)) as c,extract(month from ts_created) as m,extract(year from ts_created) as y from users";
if ($y)
$sql.=" where extract(year from ts_created)='$y' ";
$sql.=" group by extract(month from ts_created),extract(year from ts_created)
order by extract(year from ts_created),extract(month from ts_created)";
$rs = $this->db->query($sql);
$rows = $rs->fetchAll();

View File

@ -28,6 +28,7 @@
<script language="javascript" type="text/javascript" src="/static/js/plot/plugins/jqplot.pointLabels.js"></script>
<div class="cp">
<span>选择年份:</span>
<a href="/admin/stat/month/">所有年份</a>
<a href="/admin/stat/month/y/2004">2004</a>
<a href="/admin/stat/month/y/2005">2005</a>
<a href="/admin/stat/month/y/2006">2006</a>
@ -39,7 +40,7 @@
<a href="/admin/stat/month/y/2012">2012</a>
</div>
<div class="charts">
<div class="title" id="title_online"><?php echo $this->y.'年按月在线下载统计';?></div>
<div class="title" id="title_online"><?php echo $this->y.'年按月在线下载条数统计';?></div>
<?php
if($this->data!='' && count($this->data)!= 0)
@ -85,7 +86,7 @@ $(function () {
</div>
<div class="charts">
<div class="title" id="title_offline"><?php echo $this->y.'年按月离线下载量统计';?></div>
<div class="title" id="title_offline"><?php echo $this->y.'年按月离线通过申请次数统计';?></div>
<?php
if($this->offline!='' && count($this->offline)!= 0)
{