diff --git a/application/admin/controllers/StatController.php b/application/admin/controllers/StatController.php
index 4bf8cd2a..4016e379 100644
--- a/application/admin/controllers/StatController.php
+++ b/application/admin/controllers/StatController.php
@@ -71,17 +71,25 @@ class Admin_StatController extends Zend_Controller_Action
function unitAction()
{
//各单位下载情况
- $sql = "select count(o.id) as offline,count(ol.id) as online,o.unit from dataorder d
+ $sql = "select count(d.id) as num,o.unit from dataorder d
left join offlineapp o on o.id=d.offlineappid
- left join onlineapp ol on ol.unit=o.unit
- where (d.offlineappid>0 and o.unit is not null and d.status>4) or (d.onlineappid>0 and o.unit is not null)
- group by o.unit
- ";
+ where d.offlineappid>0 and o.unit is not null and d.status>4
+ group by o.unit";
$fe = $this->db->query($sql);
$unitoffline = $fe->fetchAll();
$this->view->unitoffline = $unitoffline;
+ //各单位在线下载情况
+ $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
+ group by o.unit";
+ $fe = $this->db->query($sql);
+ $unitonline = $fe->fetchAll();
+
+ $this->view->unitonline = $unitonline;
+
}//分单位统计
diff --git a/application/admin/views/scripts/stat/unit.phtml b/application/admin/views/scripts/stat/unit.phtml
index bdf432a5..88764e80 100644
--- a/application/admin/views/scripts/stat/unit.phtml
+++ b/application/admin/views/scripts/stat/unit.phtml
@@ -20,25 +20,37 @@
= $this->partial('stat/left.phtml'); ?>
-
-
-
-
-
-
-
+
+
+
-
- 单位名称 | 下载数 |
+
+ 单位名称 | 离线下载 |
unitoffline as $k=>$v)
- foreach($this->unitoffline as $k=>$v)
{
+
echo "{$v['unit']} | {$v['num']} |
";
+
}
?>
+
+ 单位名称 | 在线下载 |
+ unitonline as $k=>$v)
+
+ {
+
+ echo "{$v['unit']} | {$v['num']} |
";
+
+ }
+
+ ?>
+
+
\ No newline at end of file