|
@@ -669,4 +669,35 @@ class Home extends Base_Controller {
|
|
|
}
|
|
|
exit(json_result('0000',$this->response['0000'],$list));
|
|
|
}
|
|
|
+
|
|
|
+ // 省级设备数量
|
|
|
+ public function pro_dev_count(){
|
|
|
+ $role = $this->get_user_info('role');
|
|
|
+ $company = $this->get_user_info('company');
|
|
|
+ $where = array();
|
|
|
+
|
|
|
+ if ($role != SYSTEM_ADMIN) $where['P.company'] = $company;
|
|
|
+ $join = array();
|
|
|
+
|
|
|
+ $join[] = ['table'=>'global_location as G1','cond'=>'G1.id = P.cityid AND G1.level = 4','type'=>'inner'];
|
|
|
+ $join[] = ['table'=>'global_location as G2','cond'=>'G2.id = G1.pid AND G2.level = 3','type'=>'inner'];
|
|
|
+ $join[] = ['table'=>'global_location as G3','cond'=>'G3.id = G2.pid AND G3.level = 2','type'=>'inner'];
|
|
|
+ $list = $this->Project_model->get_list_by_join($where, 'G3.id,G3.english_name as name,sum(P.lampcount) as lampcount',NULL, NULL, $join, NULL, 'G3.id', 'P');
|
|
|
+ exit(json_result('0000',$this->response['0000'],array('list'=>$list)));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 市级设备数量
|
|
|
+ public function city_dev_count(){
|
|
|
+ $role = $this->get_user_info('role');
|
|
|
+ $company = $this->get_user_info('company');
|
|
|
+ $where = array();
|
|
|
+
|
|
|
+ if ($role != SYSTEM_ADMIN) $where['P.company'] = $company;
|
|
|
+ $join = array();
|
|
|
+
|
|
|
+ $join[] = ['table'=>'global_location as G1','cond'=>'G1.id = P.cityid','type'=>'left'];
|
|
|
+ $join[] = ['table'=>'global_location as G2','cond'=>'G2.id = G1.pid','type'=>'left'];
|
|
|
+ $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)));
|
|
|
+ }
|
|
|
}
|