wzh 5 سال پیش
والد
کامیت
991421c9fd
1فایلهای تغییر یافته به همراه14 افزوده شده و 0 حذف شده
  1. 14 0
      api/application/controllers/Home.php

+ 14 - 0
api/application/controllers/Home.php

@@ -366,6 +366,20 @@ class Home extends Base_Controller {
             if (isset($temp[$value['id']])) $temp[$value['id']]['onlineCount'] = $value['total'];
         }
 
+        $where1 = $where;
+        $where1[] = 'L.netstatus = 1 AND L.lighteness > 0';
+        $where1 = 'where '.implode(' AND ', $where1);
+        if ($type == 7) {
+            $query = 'select t1.total,t1.id from (select count(*) as total,'.$fields.' from lampinfo AS L left join project AS P on P.id = L.projectid left join global_location G on P.cityid = G.id '.$where1.' '.$group.') as t1 order by total DESC limit 10';
+        }else{
+            $query = 'select t1.total,C.id from (select count(*) as total,'.$fields.' from lampinfo AS L left join project AS P on P.id = L.projectid left join global_location G on P.cityid = G.id '.$where1.' '.$group.') as t1 left join company as C on t1.company = C.id order by total DESC limit 10';
+        }
+        
+        $list = $this->db->query($query)->result_array();
+        foreach ($list as $key => $value) {
+            if (isset($temp[$value['id']])) $temp[$value['id']]['lightCount'] = $value['total'];
+        }
+
         $where1 = $where;
         // $where1[] = 'L.netstatus = 1';
         $where1[] = '(L.controllerstatus = 5 OR L.netstatus = 0)';