|
@@ -263,21 +263,44 @@ 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)';
|
|
|
-
|
|
|
+ $where[] = 'L.netstatus = 1';
|
|
|
$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) 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())));
|
|
|
+ $join[] = ['table'=>'global_location as G1','cond'=>'G1.id = P.cityid','type'=>'inner'];
|
|
|
+ $join[] = ['table'=>'global_location as G2','cond'=>'G2.id = G1.pid','type'=>'inner'];
|
|
|
+ $join[] = ['table'=>'global_location as G3','cond'=>'G3.id = G2.pid','type'=>'inner'];
|
|
|
+ $list = $this->Lamp_model->get_list_by_join($where1, 'P.projectname as project,WI.batstatus,WI.id,WI.panelstatus,WI.lampstatus,WI.tempstatus,P.cityid,L.address,L.section,G1.english_name as areaName,G2.english_name as cityName,G3.english_name as proName,WI.updatetime,G1.timezone',NULL, NULL, $join, NULL, NUll, 'L');
|
|
|
|
|
|
- $cityArr = array_unique(array_column($list, 'cityid'));
|
|
|
+ $batstatus = $this->config->item('batstatus');
|
|
|
+ $panelstatus = $this->config->item('panelstatus');
|
|
|
+ $lampstatus = $this->config->item('lampstatus');
|
|
|
+ $tempstatus = $this->config->item('tempstatus');
|
|
|
|
|
|
- $locationList = $this->Global_location_model->get_list(['id'=>$cityArr],'pid,level,english_name as name,id');
|
|
|
+ foreach ($list as $key => $value) {
|
|
|
+ $location = $value['proName'].'/'.$value['cityName'].'/'.$value['areaName'];
|
|
|
+ $location = empty($value['section']) ? $location : $location.'/'.$value['section'];
|
|
|
+ $list[$key]['location'] = $location;
|
|
|
+ $list[$key]['fault_time'] = set_timezone($value['updatetime'],$value['timezone']);
|
|
|
+
|
|
|
+ $temp2 = array();
|
|
|
+ if (isset($batstatus[$value['batstatus']])) $temp2[] = $batstatus[$value['batstatus']];
|
|
|
+ if (isset($panelstatus[$value['panelstatus']])) $temp2[] = $panelstatus[$value['panelstatus']];
|
|
|
+ if (isset($lampstatus[$value['lampstatus']])) $temp2[] = $lampstatus[$value['lampstatus']];
|
|
|
+ if (isset($tempstatus[$value['tempstatus']])) $temp2[] = $tempstatus[$value['tempstatus']];
|
|
|
+ $list[$key]['fault_type'] = implode(',', $temp2);
|
|
|
+
|
|
|
+ unset($list[$key]['cityName']);
|
|
|
+ unset($list[$key]['proName']);
|
|
|
+ unset($list[$key]['areaName']);
|
|
|
+ unset($list[$key]['section']);
|
|
|
+ unset($list[$key]['timezone']);
|
|
|
+ unset($list[$key]['updatetime']);
|
|
|
+ }
|
|
|
|
|
|
- exit(json_result('0000',$this->response['0000'],array()));
|
|
|
+ exit(json_result('0000',$this->response['0000'],array('list'=>$list)));
|
|
|
}
|
|
|
|
|
|
// 字段管理
|