Browse Source

区域设备数量分布信息

DESKTOP-9JTA2JJ\HP 5 năm trước cách đây
mục cha
commit
bfdeac762a
1 tập tin đã thay đổi với 17 bổ sung1 xóa
  1. 17 1
      api/application/controllers/Home.php

+ 17 - 1
api/application/controllers/Home.php

@@ -705,7 +705,7 @@ class Home extends Base_Controller {
         $where = array();
         $proId = intval($this->input->post('proId',true));
 
-        if (!empty($proId)) $where['G2.pid'] = $proId;
+        if (!empty($proId)) $where['G2.id'] = $proId;
         if ($role != SYSTEM_ADMIN) $where['P.company'] = $company;
         $join = array();
 
@@ -714,4 +714,20 @@ class Home extends Base_Controller {
         $list = $this->Project_model->get_list_by_join($where, 'G2.id,G2.english_name as name,sum(P.lampcount) as lampcount',NULL, NULL, $join, NULL, 'G2.id', 'P');
         exit(json_result('0000',$this->response['0000'],array('list'=>$list)));
     }
+
+    // 区域设备数量
+    public function area_dev_count(){
+        $role = $this->get_user_info('role');
+        $company = $this->get_user_info('company');
+        $where = array();
+        $cityId = intval($this->input->post('cityId',true));
+
+        if (!empty($cityId)) $where['G1.id'] = $cityId;
+        if ($role != SYSTEM_ADMIN) $where['P.company'] = $company;
+        $join = array();
+
+        $join[] = ['table'=>'global_location as G1','cond'=>'G1.id = P.cityid','type'=>'left'];
+        $list = $this->Project_model->get_list_by_join($where, 'G1.id,G1.english_name as name,sum(P.lampcount) as lampcount',NULL, NULL, $join, NULL, 'G1.id', 'P');
+        exit(json_result('0000',$this->response['0000'],array('list'=>$list)));
+    }
 }