|
@@ -262,12 +262,20 @@ class Home extends Base_Controller {
|
|
|
|
|
|
if (!empty($projectIdArr)) $where[] = 'P.id in ('.implode(',', $projectIdArr).')';
|
|
|
|
|
|
+ $where[] = '(WI.batstatus != 0 OR WI.panelstatus != 0 OR WI.lampstatus != 0 OR WI.tempstatus != 0)';
|
|
|
+
|
|
|
$where1 = implode(' AND ', $where);
|
|
|
$join = [
|
|
|
['table'=>'project as P','cond'=>'P.id = L.projectid','type'=>'inner']
|
|
|
];
|
|
|
- $join[] = ['table'=>'(select w1.* from warning_info_log as w1 join (select lampid,max(updatetime) as maxTime from warning_info_log group by lampid) on w1.lampid = w2.lampid AND w1.updatetime = w2.maxTime) as WI','cond'=>'L.id = WI.lampid','type'=>'inner'];
|
|
|
- $total = $this->Lamp_model->get_list_by_join($where1, 'P.projectname,WI.batstatus,WI.panelstatus,WI.lampstatus,WI.tempstatus,P.cityid',NULL, NULL, $join, NULL, NUll, 'L');
|
|
|
+ $join[] = ['table'=>'(select w1.* from warning_info_log as w1 join (select lampid,max(updatetime) as maxTime from warning_info_log group by lampid) as w2 on w1.lampid = w2.lampid AND w1.updatetime = w2.maxTime) as WI','cond'=>'L.id = WI.lampid','type'=>'inner'];
|
|
|
+ $list = $this->Lamp_model->get_list_by_join($where1, 'P.projectname,WI.batstatus,WI.panelstatus,WI.lampstatus,WI.tempstatus,P.cityid,L.section',NULL, NULL, $join, NULL, NUll, 'L');
|
|
|
+
|
|
|
+ if (empty($list)) exit(json_result('0000',$this->response['0000'],array('list'=>array())));
|
|
|
+
|
|
|
+ $cityArr = array_unique(array_column($list, 'cityid'));
|
|
|
+
|
|
|
+ $locationList = $this->Global_location_model->get_list(['id'=>$cityArr],'pid,level,english_name as name,id');
|
|
|
|
|
|
exit(json_result('0000',$this->response['0000'],array()));
|
|
|
}
|