调整概况显示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,48 +14,15 @@ class Admin_StatController extends Zend_Controller_Action
} }
function indexAction() function indexAction()
{ {
$sql="select (select count(id) from users) as alluser,
//用户总量 (select count(id) from normalmetadata) as alldata,
$sql = "select count(id) as num from users"; (select count(id) as num from dataorder where status=0) as onlinedown,
$re = $this->db->query($sql); (select count(id) as num from dataorder where status=5) as offlinedown,
$alluser= $re->fetch(); (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,
$this->view->alluser=$alluser; (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(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 count(d.id) as num,o.unit from dataorder d $sql = "select count(d.id) as num,o.unit from dataorder d

View File

@ -9,49 +9,21 @@
$this->headScript()->appendFile('/js/jquery-1.6.4.min.js'); $this->headScript()->appendFile('/js/jquery-1.6.4.min.js');
$this->headScript()->appendFile('/js/jquery.masonry.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"> <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>
<div id="rightPanel"> <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="tables">
<div class="stitle">数据下载量概况</div> <div class="stitle">数据下载量概况</div>
<table> <table>