$value) { $plan_master_sql = "select plan_name from ytiot_xj_plan_master where id=" . $value['zb_id']; // print_r($plan_master_sql); $plan_master_res = add66($plan_master_sql); // print_r($plan_master_res); $spot_operation_record_sql = "select * from ytiot_xj_spot_operation_record where zb_id=" . $value['id']; // print_r($spot_operation_record_sql); $spot_operation_record_res = add66($spot_operation_record_sql); // print_r($spot_operation_record_res); if ($spot_operation_record_res != null && $plan_master_res != null) { foreach ($spot_operation_record_res as $key1 => $value1) { $dw_sql = "select * from ytiot_xj_inspection_points where id=" . $value1['spot_id']; $dw_res = add66($dw_sql); // print_r($dw_res); if ($dw_res != null) { $arr[$key]['id'] = $plan_child_res[$key]['id']; $arr[$key]['completion'] = $plan_child_res[$key]['completion']; $arr[$key]['plan_name'] = "任务名称:" . $plan_master_res[0]['plan_name']; $arr[$key]['bw'][$key1]['id'] = $spot_operation_record_res[$key1]['spot_id']; $arr[$key]['bw'][$key1]['spot_name'] = "点位名称:" . $dw_res[0]['spot_name']; $arr[$key]['bw'][$key1]['data3'] = $spot_operation_record_res[$key1]['data3']; } } } } } } } $appid = C('APPID'); # 公众号获取 $appSecret = C('SECRET'); # 实例化 $wx = new \JSSDK($appid, $appSecret); # 获取参数 $info = $wx->getWxConfig(); # 传参页面 $this->assign('wxConfig', $info); $this->assign('res5', $arr); // print_r($res[0]['id']); $this->assign('wbr_id', $res[0]['id']); $this->display('Index/inspection_system'); } public function wb_index() { $Data = I(); $this->assign('companyid', $Data['companyid']); $this->display('Index/wb_menu'); } public function xj_index() { $Data = I(); $this->assign('companyid', $Data['companyid']); $this->display('Index/xj_menu'); } public function index2() { // print_r($_SESSION['phone']); $data = I(); // print_r($data); $sql = "select * from ytiot_xj_inspectors where phone='" . $data['phone'] . "' and zn in(1,3,5,7)";//.$_SESSION['phone'];//17621295894"; $res = add66($sql); // print_r($res); $dq_time = date("Y-m-d"); $arr = array(); if ($res != null) { $ry = count($res); $ry_id_list = ''; for ($i = 0; $i < $ry; $i++) { if ($i == 0) { $ry_id_list = $res[$i]['id']; } else { $ry_id_list .= ',' . $res[$i]['id']; } } // $team_personnel_sql = "select a.team_id from ytiot_xj_team_personnel as a join ytiot_xj_plan_team as b on a.team_id=b.id where person_liable_id=".$res[0]['id']." or people_id=".$res[0]['id']." group by a.team_id"; $team_personnel_sql = "select a.team_id from ytiot_xj_team_personnel as a join ytiot_xj_plan_team as b on a.team_id=b.id where person_liable_id in(" . $ry_id_list . ") or people_id in(" . $ry_id_list . ") group by a.team_id"; $team_res = add66($team_personnel_sql); // print_r($team_res); if ($team_res != null) { $td_id_ct = count($team_res); $td_id_list = ''; for ($i = 0; $i < $td_id_ct; $i++) { if ($i == 0) { $td_id_list = $team_res[$i]['team_id']; } else { $td_id_list .= ',' . $team_res[$i]['team_id']; } } $plan_child_sql = "select a.*,b.cycle from ytiot_xj_plan_child as a join ytiot_xj_plan_master as b on a.zb_id=b.id where a.team_id in(" . $td_id_list . ") and a.data2='2'"; // $plan_child_sql="select * from ytiot_xj_plan_child where inspect_date='".$dq_time."' and team_id in(".$td_id_list.") and data2='2'"; // print_r($plan_child_sql); $plan_child_res = add66($plan_child_sql); // print_r($plan_child_res); if ($plan_child_res != null) { foreach ($plan_child_res as $key => $value) { // print_r(strtotime("+7 day",strtotime($plan_child_res[$key]['inspect_date']))); if (($plan_child_res[$key]['cycle'] == 0 && $plan_child_res[$key]['inspect_date'] == $dq_time) || ($plan_child_res[$key]['cycle'] == 1 && strtotime("+7 day", strtotime($plan_child_res[$key]['inspect_date'])) > strtotime($dq_time)) || ($plan_child_res[$key]['cycle'] == 2 && strtotime("+1 month", strtotime($plan_child_res[$key]['inspect_date'])) > strtotime($dq_time))) { $plan_master_sql = "select plan_name from ytiot_xj_plan_master where id=" . $value['zb_id']; // print_r($plan_master_sql); $plan_master_res = add66($plan_master_sql); // print_r($plan_master_res); $spot_operation_record_sql = "select * from ytiot_xj_spot_operation_record where zb_id=" . $value['id']; // print_r($spot_operation_record_sql); $spot_operation_record_res = add66($spot_operation_record_sql); // print_r($spot_operation_record_res); if ($spot_operation_record_res != null && $plan_master_res != null) { foreach ($spot_operation_record_res as $key1 => $value1) { $dw_sql = "select * from ytiot_xj_inspection_points where id=" . $value1['spot_id']; $dw_res = add66($dw_sql); // print_r($dw_res); if ($dw_res != null) { $arr[$key]['id'] = $plan_child_res[$key]['id']; $arr[$key]['completion'] = $plan_child_res[$key]['completion']; $arr[$key]['plan_name'] = "任务名称:" . $plan_master_res[0]['plan_name']; $arr[$key]['bw'][$key1]['id'] = $spot_operation_record_res[$key1]['spot_id']; $arr[$key]['bw'][$key1]['spot_name'] = "点位名称:" . $dw_res[0]['spot_name']; $arr[$key]['bw'][$key1]['data3'] = $spot_operation_record_res[$key1]['data3']; } } } } } } } } $appid = C('APPID'); # 公众号获取 $appSecret = C('SECRET'); # 实例化 $wx = new \JSSDK($appid, $appSecret); # 获取参数 $info = $wx->getWxConfig(); # 传参页面 $this->assign('wxConfig', $info); $this->assign('res5', $arr); // print_r($arr); $this->assign('wbr_id', $res[0]['id']); $this->display('Index/maintenance_system'); } public function maintenance_record() { $data = I(); $buding_id = M()->query("SELECT building_id FROM sp_owner_company WHERE owner_id='".$data['companyid']."'"); $sql = "select a.*,b.spot_name,d.plan_name from ytiot_xj_spot_operation_record AS a LEFT JOIN ytiot_xj_inspection_points AS b ON a.spot_id=b.id LEFT JOIN ytiot_xj_plan_child AS c ON a.zb_id=c.id LEFT JOIN ytiot_xj_plan_master AS d ON c.zb_id=d.id where a.data3=2 and a.data2=2 and a.company_code='".$buding_id[0]['building_id']."' order by a.id desc"; // $sql = "select * from ytiot_xj_spot_operation_record where data3=2 and data2=2 order by id desc"; $res = add($sql); foreach ($res as $key => $value) { if ($res[$key]['spot_abnormal'] == 0) { $res[$key]['spot_status'] = "正常"; } elseif ($res[$key]['spot_abnormal'] == 1) { $res[$key]['spot_status'] = "异常"; } elseif ($res[$key]['spot_abnormal'] == 2) { $res[$key]['spot_status'] = "故障"; } elseif ($res[$key]['spot_abnormal'] == 3) { $res[$key]['spot_status'] = "其他"; } // if (!empty($res[$key]['spot_id'])) { // $points_sql = "select * from ytiot_xj_inspection_points where id=" . $res[$key]['spot_id']; // $points_res = add($points_sql); // $res[$key]['spot_name'] = $points_res[0]['spot_name']; //// $res[$key]['spot_address']=$points_res[0]['spot_address']; // } // if (!empty($res[$key]['spot_id'])) { // $jhz_sql = "select * from ytiot_xj_plan_child where id=" . $res[$key]['zb_id']; // $jhz_res = add($jhz_sql); // $jh_sql = "select * from ytiot_xj_plan_master where id=" . $jhz_res[0]['zb_id']; // $jh_res = add($jh_sql); // $res[$key]['plan_name'] = $jh_res[0]['plan_name']; //// $res[$key]['spot_address']=$jh_res[0]['spot_address']; // } // if (!empty($res[$key]['spot_id'])){ // $zrr_sql="select * from ytiot_xj_inspectors where id=".$res[$key]['wbr_id']; // $zrr_res=add($zrr_sql); // $res[$key]['name']=$zrr_res[0]['name']; // $res[$key]['spot_address']=$zrr_res[0]['phone']; // } } $this->assign('companyid', $data['companyid']); $this->assign('res', $res); $this->display('Index/maintenance_list'); } public function inspection_record() { $data = I(); $buding_id = M()->query("SELECT building_id FROM sp_owner_company WHERE owner_id='".$data['companyid']."'"); $sql = "select a.*,b.spot_name,d.plan_name from ytiot_xj_spot_operation_record AS a LEFT JOIN ytiot_xj_inspection_points AS b ON a.spot_id=b.id LEFT JOIN ytiot_xj_plan_child AS c ON a.zb_id=c.id LEFT JOIN ytiot_xj_plan_master AS d ON c.zb_id=d.id where a.data3=2 and a.data2=1 and a.company_code='".$buding_id[0]['building_id']."' order by a.id desc"; // $sql = "select * from ytiot_xj_spot_operation_record where data3=2 and data2=1 order by id desc"; $res = add($sql); foreach ($res as $key => $value) { if ($res[$key]['spot_abnormal'] == 0) { $res[$key]['spot_status'] = "正常"; } elseif ($res[$key]['spot_abnormal'] == 1) { $res[$key]['spot_status'] = "异常"; } elseif ($res[$key]['spot_abnormal'] == 2) { $res[$key]['spot_status'] = "故障"; } elseif ($res[$key]['spot_abnormal'] == 3) { $res[$key]['spot_status'] = "其他"; } // if (!empty($res[$key]['spot_id'])) { // $points_sql = "select * from ytiot_xj_inspection_points where id=" . $res[$key]['spot_id']; // $points_res = add($points_sql); // $res[$key]['spot_name'] = $points_res[0]['spot_name']; // } // // if (!empty($res[$key]['spot_id'])) { // $jhz_sql = "select * from ytiot_xj_plan_child where id=" . $res[$key]['zb_id']; // $jhz_res = add($jhz_sql); // $jh_sql = "select * from ytiot_xj_plan_master where id=" . $jhz_res[0]['zb_id']; // $jh_res = add($jh_sql); // $res[$key]['plan_name'] = $jh_res[0]['plan_name']; // } } $this->assign('companyid', $data['companyid']); $this->assign('res', $res); $this->display('Index/inspection_list'); } public function details() { $data = I(); $record_id = $data['id']; $sql = "select * from ytiot_xj_spot_operation_record where id=" . $record_id; $res = add($sql); if ($res[0]['spot_abnormal'] == 0) { $res[0]['spot_status'] = "正常"; } elseif ($res[0]['spot_abnormal'] == 1) { $res[0]['spot_status'] = "异常"; } elseif ($res[0]['spot_abnormal'] == 2) { $res[0]['spot_status'] = "故障"; } elseif ($res[0]['spot_abnormal'] == 3) { $res[0]['spot_status'] = "其他"; } if (!empty($res[0]['spot_id'])) { $jhz_sql = "select * from ytiot_xj_plan_child where id=" . $res[0]['zb_id']; $jhz_res = add($jhz_sql); $jh_sql = "select * from ytiot_xj_plan_master where id=" . $jhz_res[0]['zb_id']; $jh_res = add($jh_sql); $res[0]['plan_name'] = $jh_res[0]['plan_name']; } if (!empty($res[0]['spot_id'])) { $points_sql = "select * from ytiot_xj_inspection_points where id=" . $res[0]['spot_id']; $points_res = add($points_sql); $res[0]['spot_name'] = $points_res[0]['spot_name']; $res[0]['spot_address'] = $points_res[0]['spot_address']; } if (!empty($res[0]['wbr_id'])) { $zrr_sql = "select * from ytiot_xj_inspectors where id=" . $res[0]['wbr_id']; $zrr_res = add($zrr_sql); $res[0]['name'] = $zrr_res[0]['name']; $res[0]['phone'] = $zrr_res[0]['phone']; } if (!empty($res[0]['company_code'])) { // $zrr_sql="select * from ytiot_xj_inspectors where id=".$res[0]['company_code']; // $zrr_res=add($zrr_sql); $company_data = M()->query("select owner_name,owner_address from sp_owner_company where building_id='" . $res[0]['company_code'] . "'"); $res[0]['owner_name'] = $company_data[0]['owner_name']; $res[0]['owner_address'] = $company_data[0]['owner_address']; } if (!empty($res[0]['id'])) { $photos_sql = "select report_photos from ytiot_xj_operation_record_photos where dwczjl_id=" . $res[0]['id']; $photos_res = add($photos_sql); $res[0]['report_photos'] = $photos_res[0]['report_photos']; } $this->assign('companyid', $data['companyid']); $this->assign('res', $res[0]); $this->display('Index/maintenance_details'); } public function xj_details() { $data = I(); $record_id = $data['id']; $sql = "select * from ytiot_xj_spot_operation_record where id=" . $record_id; $res = add($sql); if ($res[0]['spot_abnormal'] == 0) { $res[0]['spot_status'] = "正常"; } elseif ($res[0]['spot_abnormal'] == 1) { $res[0]['spot_status'] = "异常"; } elseif ($res[0]['spot_abnormal'] == 2) { $res[0]['spot_status'] = "故障"; } elseif ($res[0]['spot_abnormal'] == 3) { $res[0]['spot_status'] = "其他"; } if (!empty($res[0]['spot_id'])) { $jhz_sql = "select * from ytiot_xj_plan_child where id=" . $res[0]['zb_id']; $jhz_res = add($jhz_sql); $jh_sql = "select * from ytiot_xj_plan_master where id=" . $jhz_res[0]['zb_id']; $jh_res = add($jh_sql); $res[0]['plan_name'] = $jh_res[0]['plan_name']; } if (!empty($res[0]['spot_id'])) { $points_sql = "select * from ytiot_xj_inspection_points where id=" . $res[0]['spot_id']; $points_res = add($points_sql); $res[0]['spot_name'] = $points_res[0]['spot_name']; $res[0]['spot_address'] = $points_res[0]['spot_address']; } if (!empty($res[0]['wbr_id'])) { $zrr_sql = "select * from ytiot_xj_inspectors where id=" . $res[0]['wbr_id']; $zrr_res = add($zrr_sql); $res[0]['name'] = $zrr_res[0]['name']; $res[0]['phone'] = $zrr_res[0]['phone']; } if (!empty($res[0]['company_code'])) { // $zrr_sql="select * from ytiot_xj_inspectors where id=".$res[0]['company_code']; // $zrr_res=add($zrr_sql); $company_data = M()->query("select owner_name,owner_address from sp_owner_company where building_id='" . $res[0]['company_code'] . "'"); $res[0]['owner_name'] = $company_data[0]['owner_name']; $res[0]['owner_address'] = $company_data[0]['owner_address']; } if (!empty($res[0]['id'])) { $photos_sql = "select report_photos from ytiot_xj_operation_record_photos where dwczjl_id=" . $res[0]['id']; $photos_res = add($photos_sql); $res[0]['report_photos'] = $photos_res[0]['report_photos']; } $this->assign('companyid', $data['companyid']); $this->assign('res', $res[0]); $this->display('Index/inspectione_details'); } public function getDeviceList() { $Data = I(); $record_id = $Data['record_id']; $spot_id = $Data['spot_id']; $sql = "select a.spot_id,b.* from ytIoT.ytiot_xj_spot_equipment as a JOIN jdxf.sp_owner as b ON a.equipment_code=b.owner_code where spot_id=" . $spot_id; $res = add($sql); $this->assign('record_id', $record_id); $this->assign('spot_id', $spot_id); $this->assign('res', $res); $this->display('point_details/point_details'); } public function getDeviceDetails() { $Data = I(); $record_id = $Data['record_id']; $spot_id = $Data['spot_id']; $this->assign('record_id', $record_id); $this->assign('spot_id', $spot_id); if ($Data['dwtype'] == 16) { $owner_xx = M()->query("select owner_code, owner_name, unitinfo, sim, install_time,rtmp,hls,dwtype from sp_owner where owner_code='" . $Data['deviceid'] . "'"); $owner_address = M()->query("select owner_address from sp_owner_company where owner_id='" . $Data['companyid'] . "'"); $gzsj = M()->query("select data4,time from sp_video2017 where device_code='" . $Data['deviceid'] . "' order by time desc"); if (!empty($owner_xx[0]['rtmp'])) { $owner_xx[0]['rtmp'] = $owner_xx[0]['rtmp']; } else { $owner_xx[0]['rtmp'] = '     无'; } $this->assign('type_name', "视频监控"); $this->assign('type', "video"); $this->assign('companyid', $Data['companyid']); $this->assign('owner_xx', $owner_xx); $this->assign('owner_address', $owner_address); $this->assign('gzsj', $gzsj); $this->display('point_details/000001'); } else if ($Data['dwtype'] == 17) { $owner_xx = M()->query("select owner_code, owner_name, unitinfo, sim, install_time,rtmp,hls,dwtype from sp_owner where owner_code='" . $Data['deviceid'] . "'"); $owner_address = M()->query("select owner_address from sp_owner_company where owner_id='" . $Data['companyid'] . "'"); $gzsj = M()->query("select data4,time from sp_lifter2017 where device_code='" . $Data['deviceid'] . "' order by time desc"); if (!empty($owner_xx[0]['rtmp'])) { $owner_xx[0]['rtmp'] = $owner_xx[0]['rtmp']; } else { $owner_xx[0]['rtmp'] = '     无'; } $this->assign('type_name', "电梯监控"); $this->assign('type', "elevator"); $this->assign('companyid', $Data['companyid']); $this->assign('owner_xx', $owner_xx); $this->assign('owner_address', $owner_address); $this->assign('gzsj', $gzsj); $this->display('point_details/000001'); } else if ($Data['dwtype'] == 4) { $owner_xx = M()->query("select owner_code, owner_name, unitinfo, sim, install_time,rtmp,hls,dwtype from sp_owner where owner_code='" . $Data['deviceid'] . "'"); $owner_address = M()->query("select owner_address from sp_owner_company where owner_id='" . $Data['companyid'] . "'"); $gzsj = M()->query("select data4,time from sp_d" . $Data['deviceid'] . " where device_code='" . $Data['deviceid'] . "' order by time desc"); if (!empty($owner_xx[0]['rtmp'])) { $owner_xx[0]['rtmp'] = $owner_xx[0]['rtmp']; } else { $owner_xx[0]['rtmp'] = '     无'; } $this->assign('type_name', "消防栓监控"); $this->assign('type', "firehydrant"); $this->assign('companyid', $Data['companyid']); $this->assign('owner_xx', $owner_xx); $this->assign('owner_address', $owner_address); $this->assign('gzsj', $gzsj); $this->display('point_details/000001'); } else if ($Data['dwtype'] == 128) { $owner_xx = M()->query("select owner_code, owner_name, unitinfo, sim, install_time,rtmp,hls,dwtype from sp_owner where owner_code='" . $Data['deviceid'] . "'"); $owner_address = M()->query("select owner_address from sp_owner_company where owner_id='" . $Data['companyid'] . "'"); $gzsj = M()->query("select device_status,time from sp_iw2017 where device_code='" . $Data['deviceid'] . "' order by time desc"); if (!empty($owner_xx[0]['rtmp'])) { $owner_xx[0]['rtmp'] = $owner_xx[0]['rtmp']; } else { $owner_xx[0]['rtmp'] = '     无'; } if ($gzsj[0]['device_status']) { $gzsj[0]['data4'] = '正常'; } else { $gzsj[0]['data4'] = '打开告警'; } $this->assign('type_name', "井盖监控"); $this->assign('type', "firehydrant"); $this->assign('companyid', $Data['companyid']); $this->assign('owner_xx', $owner_xx); $this->assign('owner_address', $owner_address); $this->assign('gzsj', $gzsj); $this->display('point_details/000001'); } else { $res = M()->query("SELECT * FROM sp_v_deviceall WHERE deviceid='" . $Data['deviceid'] . "'"); $azwz = M()->query("select unitinfo from sp_owner where owner_code='" . $Data['deviceid'] . "'"); $res[0]['azwz'] = $azwz[0]['unitinfo']; //在线离线权限问题 $login_phone = M()->query("SELECT * FROM sp_login_phone"); $phone_arr = array(); foreach ($login_phone as $key => $value) { $phone_arr[$key] = $login_phone[$key]['phone']; } $phone = $_SESSION['phone']; $isin = in_array($phone, $phone_arr); if ($isin) { $phone_pd = 1; } else { $phone_pd = 0; } $time = M()->query("SELECT device_id,MAX(data_time) as data_time FROM sp_owner_status WHERE device_id='" . $Data['deviceid'] . "'"); if (!empty($time)) { $stime = date('Y-m-d h:i:s', time()); $etime = $time[0]['data_time']; $hour = intval((strtotime($stime) - strtotime($etime)) / 3600); if ($hour < 24) { $zs_status = '在线'; } else { $zs_status = '离线'; } } else { $zs_status = '状态不存在'; } if ($res[0]['dwtype'] != 1) { if ($phone_pd == 1) { $res[0]['zs_status'] = $zs_status; } } if (!empty($res[0]['rtmp'])) { $res[0]['rtmp'] = $res[0]['rtmp']; } else { $res[0]['rtmp'] = '     无'; } $this->assign('list', $res[0]); $this->assign('companyid', $Data['companyid']); $dwtype = $res[0]['dwtype']; $deviceid = $Data['deviceid']; if ($dwtype == 1) { $j2017 = M('hj2017'); $counts = $j2017->order('time desc')->where(array('device_code' => $deviceid))->count('id');//总数 $j_counts = $j2017->where(array('device_code' => $deviceid, 'clzt' => '1'))->count('id');//解决总数 $d_counts = $j2017->where(array('device_code' => $deviceid, 'clwb' => '否'))->count('id');//真实总数 $w_counts = $j2017->where(array('device_code' => $deviceid, 'clwb' => '是'))->count('id');//wb总数 $this->assign('dwtype', 1); $this->assign('counts', $counts); $this->assign('j_counts', $j_counts); $this->assign('z_counts', $d_counts); $this->assign('w_counts', $w_counts); $this->display('point_details/000002'); } if ($dwtype == 2) { $shui = M()->query("select * from sp_owner_sync_data where device_id='" . $Data['deviceid'] . "' and point_code=4 order by data_time desc"); $electric_data = M()->query("select point_data from sp_owner_sync_data where device_id='" . $Data['deviceid'] . "' and point_code=2 order by data_time desc"); $signal_data = M()->query("select point_data from sp_owner_sync_data where device_id='" . $Data['deviceid'] . "' and point_code=3 order by data_time desc"); $a = array(); $b = array(); $electric = array(); $signal = array(); foreach ($shui as $value) { $a[] = $value['data_time']; $b[] = $value['point_data']; } foreach ($electric_data as $value) { $electric[] = $value['point_data']; } foreach ($signal_data as $value) { $signal[] = $value['point_data'] * 20; } $bb = $shui[0]; $this->assign('bb', $bb['point_data']); $this->assign('dwtype', 2); $this->assign('time', json_encode($a)); $this->assign('data4', json_encode($b)); $this->assign('electric', json_encode($electric)); $this->assign('signal', json_encode($signal)); $this->display('point_details/000004'); } if ($dwtype == 3) { $fume = M()->query("select RSRQ, DeviceStatus, BatteryLevel, storeTime, device_id from sp_y" . $deviceid . " ORDER BY storeTime DESC limit 1"); $a = M()->query("select dwtype, sim,install_time,rtmp,hls from sp_owner where owner_code='" . $deviceid . "'"); if ($a[0]['dwtype'] == 3) { $a[0]['dwtype'] = '烟感'; } if (!empty($a[0]['rtmp'])) { $a[0]['rtmp'] = $a[0]['rtmp']; } else { $a[0]['rtmp'] = '     无'; } foreach ($fume as $key => $arr) { if ($fume[$key]['devicestatus'] == 7) { $fume[$key]['type'] = '正常'; } else if ($fume[$key]['devicestatus'] == 5) { $fume[$key]['type'] = '故障'; } else if ($fume[$key]['devicestatus'] == 4) { $fume[$key]['type'] = '低压'; } else if ($fume[$key]['devicestatus'] == 2) { $fume[$key]['type'] = '报警静音'; } else if ($fume[$key]['devicestatus'] == 1) { $fume[$key]['type'] = '报警'; } } $this->assign('dwtype', 3); $this->assign('a', $a); $this->assign('fume', $fume); $this->display('point_details/000003'); } //液位 if ($dwtype == 5) { $shui = M()->query("select * from sp_owner_sync_data where device_id='" . $Data['deviceid'] . "' and point_code=4 order by data_time desc"); $a = array(); $b = array(); foreach ($shui as $value) { $a[] = $value['data_time']; $b[] = $value['point_data']; } $bb = $shui[0]; $this->assign('bb', $bb['point_data']); $this->assign('dwtype', 5); $this->assign('time', json_encode($a)); $this->assign('data4', json_encode($b)); $this->display('point_details/000007'); } if ($dwtype == 6) { $rtu = M()->query("SELECT id,data4,ncmd,`time`,data1,data2,CASE WHEN `port`='E6' THEN '模拟量' WHEN `port`='E3' THEN '开关量' END as types FROM sp_d" . $deviceid . " WHERE id in(SELECT MAX(id) FROM sp_d" . $deviceid . " GROUP BY `port`,ncmd) AND ncmd !='' " . (($deviceid == '4023363030303635') ? " AND (ncmd !='02' OR `port`!='E6') " : (($deviceid == '4023363030303639') ? " AND (ncmd !='03' OR `port`!='E6') " : (($deviceid == '4023363030303434') ? " AND (ncmd !='04' OR `port`!='E3') AND (ncmd !='05' OR `port`!='E3')" : (($deviceid == '4023363030303336') ? " AND (ncmd !='01' OR `port`!='E6') " : (($deviceid == '4023363030303733') ? " AND (ncmd !='05' AND ncmd !='06' )" : "")))))//山海大酒店B1楼水泵房02端口模拟量因设备故障,暂时屏蔽 ); $this->assign('dwtype', 6); $this->assign('rtu', $rtu); $res = M()->query("SELECT systype FROM sp_owner_port where owner_code='" . $deviceid . "'"); $this->assign("trues", '0' . $res[0]['systype']); $this->display('point_details/000005'); } // 电气火灾 if ($dwtype == 7) { $install_time = M()->query("select install_time,rtmp,hls,owner_name,sim from sp_owner where owner_code='" . $Data['deviceid'] . "'"); $owner_address = M()->query("select owner_address from sp_owner_company where owner_id=" . $Data['companyid']); $true_status = M()->query("select true_status from sp_devices_status where deviceid=" . $Data['deviceid']); $xssj = M()->query("select * from sp_owner_status where device_id='" . $Data['deviceid'] . "'"); $zxsj = M()->query("select max(data_time) as zxsj from sp_owner_status where device_id='" . $Data['deviceid'] . "'"); if ($true_status[0]['true_status'] == '75') { $dstatus = '离线'; } else { $dstatus = '在线'; } if (!empty($install_time[0]['rtmp'])) { $install_time[0]['rtmp'] = $install_time[0]['rtmp']; } else { $install_time[0]['rtmp'] = '     无'; } $data = array( 'owner_name' => $install_time[0]['owner_name'], 'dstatus' => $dstatus, 'dthz' => '电气火灾', 'deviceid' => $Data['deviceid'], 'sim' => $install_time[0]['sim'], 'install_time' => $install_time[0]['install_time'], 'owner_address' => $owner_address[0]['owner_address'], 'rtmp' => $install_time[0]['rtmp'], 'hls' => $install_time[0]['hls'], ); $this->assign('dwtype', 7); $this->assign('xssj', $xssj); $this->assign('zxsj', $zxsj); $this->assign('data', $data); $this->display('point_details/000006'); } } } }