调整概况显示SQL查询

This commit is contained in:
wlx 2011-11-21 12:31:24 +00:00
parent d1a3badcdb
commit 47384fc89c
2 changed files with 22 additions and 83 deletions

View File

@ -14,49 +14,16 @@ class Admin_StatController extends Zend_Controller_Action
}
function indexAction()
{
//用户总量
$sql = "select count(id) as num from users";
$re = $this->db->query($sql);
$alluser= $re->fetch();
$this->view->alluser=$alluser;
//所有数据
$sql = "select count(id) as num from metadata";
$re = $this->db->query($sql);
$alldata=$re->fetch();
$this->view->alldata=$alldata;
//数据下载总量 通过dataorder统计??
$sql = "select count(id) as num from dataorder";
$re = $this->db->query($sql);
$alldown=$re->fetch();
$this->view->alldown=$alldown;
//已通过的离线申请个数
$sql = "select count(id) as num from dataorder where offlineappid>0 and status>4";
$re = $this->db->query($sql);
$allpass = $re->fetch();
$this->view->allpass = $allpass;
//未通过的离线申请个数
$sql="select count(id) as num from dataorder where offlineappid>0 and status<4";
$re = $this->db->query($sql);
$nopass = $re->fetch();
$this->view->nopass = $nopass;
//在线下载点击次数
$sql="select count(id) as num from onlineapp";
$re = $this->db->query($sql);
$onlinedown = $re->fetch();
$this->view->onlinedown = $onlinedown;
$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 dataorder where offlineappid>0 and status>4) as offlinepass,
(select count(id) as num from dataorder where offlineappid>0 and status in (2,3,4)) 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";
$this->view->stat=$this->db->fetchRow($sql);
//各单位下载情况
$sql = "select count(d.id) as num,o.unit from dataorder d
left join offlineapp o on o.id=d.offlineappid

View File

@ -9,49 +9,21 @@
$this->headScript()->appendFile('/js/jquery-1.6.4.min.js');
$this->headScript()->appendFile('/js/jquery.masonry.min.js');
?>
<style>
.tables{width:320px;float:left;}
.tables .stitle{width:100%;font-size:16px;font-weight:bold;}
</style>
<div id="leftPanel">
<?= $this->partial('stat/left.phtml'); ?>
<?= $this->partial('stat/left.phtml'); ?>
<ul>
<li class="title">概况</li>
<li>用户总数:<?php echo $this->stat['alluser']; ?></li>
<li>元数据条数:<?php echo $this->stat['alldata']; ?></li>
<li>在线数据下载次数:<?php echo $this->stat['onlinedown']; ?></li>
<li>在线数据下载次数:<?php echo $this->stat['offlinedown']; ?></li>
<li>已通过的离线申请:<?php echo $this->stat['offlinepass']; ?></li>
<li>未完成的离线申请:<?php echo $this->stat['offlineunfinished']; ?></li>
<li>被拒绝的离线申请:<?php echo $this->stat['offlinedenied']; ?>人次</li>
<li>有记录的在线下载数:<?php echo $this->stat['onlineapp']; ?></li>
</ul>
</div>
<div id="rightPanel">
<div class="tables">
<div class="stitle">概况</div>
<table>
<thead>
<tr><td width="200">说明</td><td width="100"></td></tr>
</thead>
<tr>
<td>用户总数</td>
<td><?php echo $this->alluser['num'];?></td>
</tr>
<tr>
<td>metadata数据总数</td>
<td><?php echo $this->alldata['num'];?></td>
</tr>
<tr>
<td>数据下载总次数</td>
<td><?php echo $this->alldown['num'];?></td>
</tr>
<tr>
<td>已通过的离线申请</td>
<td><?php echo $this->allpass['num'];?></td>
</tr>
<tr>
<td>未通过的离线申请</td>
<td><?php echo $this->nopass['num'];?></td>
</tr>
<tr>
<td>在线下载申请次数</td>
<td><?php echo $this->onlinedown['num'];?></td>
</tr>
</table>
</div>
<div class="tables">
<div class="stitle">数据下载量概况</div>
<table>