更新后台统计功能

This commit is contained in:
wlx 2014-06-11 09:08:11 +00:00
parent 4a492a9589
commit 239554b3ac
6 changed files with 15 additions and 18 deletions

View File

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

View File

@ -12,7 +12,6 @@
<li><a href="/admin/review"><span>元数据评审</span></a></li>
<li><a href="/admin/news"><span>新闻中心</span></a></li>
<li><a href="/admin/stat"><span>统计数据</span></a></li>
<li><a href="/admin/sys"><span>系统管理</span></a></li>
</ul>
<p class="navbar-text pull-right">
<?php

View File

@ -17,7 +17,6 @@
<?= $this->partial('review/left.phtml'); ?>
<?= $this->partial('news/left.phtml'); ?>
<?= $this->partial('stat/left.phtml'); ?>
<?= $this->partial('sys/left.phtml'); ?>
</div>
<!--
<script>

View File

@ -4,6 +4,4 @@
<li><a href="/admin/stat/unit">分单位统计</a></li>
<li><a href="/admin/stat/month">分月统计</a></li>
<li><a href="/admin/stat/user">按用户统计</a></li>
<li><a href="/admin/stat/awstatsweb">awstats web统计</a></li>
<li><a href="/admin/stat/awstatsftp">awstats ftp统计</a></li>
</ul>

View File

@ -31,7 +31,6 @@
<div class="cp">
<span>选择年份:</span>
<a href="/admin/stat/month/">所有年份</a>
<a href="/admin/stat/month/y/2013">2013</a>
<a href="/admin/stat/month/y/2014">2014</a>
<a href="/admin/stat/month/y/2015">2015</a>
</div>

View File

@ -30,7 +30,7 @@
<li><a href="/admin/stat/unit/" class="<?= $active?>">总体查看(默认)</a></li>
<?php
$active="";
for($i=2004; $i<=date("Y",time()); $i++)
for($i=2014; $i<=date("Y",time()); $i++)
{
if(!empty($this->y))
{