assign('companyid', $Data['companyid']); $this->display('Index/rgdcd_catalog'); } public function index_list() { $Data = I(''); $ResData = ytapi_query("select count(*) from person_data where clzt=0 and company_code=" . $Data['companyid']); $this->assign('dcd', $ResData[0]['count(*)']); $this->assign('companyid', $Data['companyid']); // print_r($Data['companyid']); $this->display('Index/fire_inspector'); // print_r($ResData[0]['count(*)']); } public function electronics_list() { $Data = I(''); // print_r($Data); $ResData = ytapi_query("select count(*) from jingan_analysis_data where status=0 and clzt=0 and company_code=" . $Data['companyid']." and content != '设备离线'"); $this->assign('dcd', $ResData[0]['count(*)']); $this->assign('companyid', $Data['companyid']);; $this->display('Index/electronics_inspector'); } public function change() { $Data = I(''); $company_code = $Data['companyid']; switch ($Data['type']) { case 'untreated': $status = "and clzt=0"; break; case 'treated': $status = "and clzt=1"; break; default: break; } $ResData = ytapi_query("select id,content,timestamp,artificial_code,clzt from person_data where company_code='" . $company_code . "' " . $status . " order by timestamp desc LIMIT 1000"); // print_r($ResData); foreach ($ResData as $key => $value) { $str = str_replace('"]', '', $ResData[$key]['content']); $ResData[$key]['content'] = str_replace('["', '', $str); } // print_r($company_code); $this->assign('companyid', $company_code); $this->assign('ResData', $ResData); $this->display('Index/fire_inspector-list'); } public function change1() { $Data = I(''); $company_code = $Data['companyid']; // print_r($Data); // exit(); switch ($Data['type']) { case 'untreated': $status = "and clzt=0"; break; case 'treated': $status = "and clzt=1"; break; default: break; } // print_r("select id,content,timestamp,supervise_code,clzt from jingan_analysis_data where status=0 and content !='设备离线' and company_code='" . $company_code . "' " . $status . " order by timestamp desc LIMIT 1000"); // exit(); $ResData = ytapi_query("select id,content,timestamp,supervise_code,clzt from jingan_analysis_data where status=0 and content !='设备离线' and company_code='" . $company_code . "' " . $status . " order by timestamp desc LIMIT 1000"); foreach ($ResData as $key => $value) { $str = str_replace('"]', '', $ResData[$key]['content']); $ResData[$key]['content'] = str_replace('["', '', $str); } $this->assign('companyid', $company_code); $this->assign('ResData', $ResData); // print_r($ResData); // exit(); $this->display('Index/electronics_inspector-list'); } //报警明细 public function index() { $Data = I(); // print_r($Data['companyid']); $res = ytapi_query("select * from person_data where id=" . $Data['id']); if ($res[0]['clzt']) { $res[0]['wtype'] = "已处理"; } else { $res[0]['wtype'] = "未处理"; } $str = str_replace('"]', '', $res[0]['content']); $res[0]['content'] = str_replace('["', '', $str); if ($res[0]['cl_time'] == '1978-00-00 00:00:00') { $res[0]['cl_time'] = ''; } $this->assign('companyid', $Data['companyid']); $this->assign('res', $res[0]); if ($res[0]['clzt'] == 0) { $this->display('Index/dcdyclxq'); } else { $this->display('Index/dcdwclxq'); } } //电子督察单报警明细 public function index1() { $Data = I(); $res = ytapi_query("select * from jingan_analysis_data where id=" . $Data['id']." and status=0"); if ($res[0]['clzt']) { $res[0]['wtype'] = "已处理"; } else { $res[0]['wtype'] = "未处理"; } $str = str_replace('"]', '', $res[0]['content']); $res[0]['content'] = str_replace('["', '', $str); if ($res[0]['cl_time'] == '1978-00-00 00:00:00') { $res[0]['cl_time'] = ''; } // print_r($res); if ($res[0]['type']==1||$res[0]['type']==2||$res[0]['type']==3){ if (!empty($res[0]['mainframe_id'])){ $a=substr($res[0]['mainframe_id'],2); } $arr=M()->query("select owner_name from sp_owner where owner_code='".$a."'"); // print_r("select info from sp_owner_point where device_code='".$a."' and `loop`=".$res[0]['loop_number']." and pno=".$res[0]['position_number'].""); if(strlen($res[0]['loop_number'])==4){ $zj=substr($res[0]['loop_number'],0,strlen($res[0]['loop_number'])-3); $hl=(int)substr($res[0]['loop_number'],1); $arr1=M()->query("select info from sp_owner_point where device_code='".$a."' and `loop`='".$hl."' and pno='".$res[0]['position_number']."' and host_num='".$zj."'"); }else{ $arr1=M()->query("select info from sp_owner_point where device_code='".$a."' and `loop`='".$res[0]['loop_number']."' and pno='".$res[0]['position_number']."'"); } if (!empty($arr1[0]['info'])){ $res[0]['nr']="设备名称:".$arr[0]['owner_name'].",回路号:".$res[0]['loop_number'].",点位号:".$res[0]['position_number'].",点位描述:".$arr1[0]['info'].""; }else{ $res[0]['nr']="设备名称:".$arr[0]['owner_name'].",回路号:".$res[0]['loop_number'].",点位号:".$res[0]['position_number']; } }else if ($res[0]['type']==4){ if (strpos($res[0]['content'],"泵") !== false){ if (!empty($res[0]['device_id'])){ // print_r($res[0]['device_id']); // print_r("select owner_name from sp_owner where owner_code='".substr($res[0]['device_id'],0,strlen($res[0]['device_id'])-1)."'"); $arr=M()->query("select owner_name from sp_owner where owner_code='".substr($res[0]['device_id'],0,strlen($res[0]['device_id'])-1)."'"); if (!empty($arr[0]['owner_name'])){ $res[0]['nr']="设备名称:".$arr[0]['owner_name']; }else{ $arr1=M()->query("select owner_name from sp_owner where owner_code='".$res[0]['device_id']."'"); if (!empty($arr1[0]['owner_name'])){ $res[0]['nr']="设备名称:".$arr1[0]['owner_name']; }else{ $res[0]['nr']=""; } } } } }else{ $res[0]['nr']=""; } // print_r($res[0]); $this->assign('companyid', $Data['companyid']); $this->assign('res', $res[0]); if ($res[0]['clzt'] == 0) { $this->display('Index/dzdcdyclxq'); } else { $this->display('Index/dzdcdwclxq'); } } //提交上传 public function outputs() { // dump(I()); if ($_SESSION['phone'] == '15000012454' || $_SESSION['idphone'] == '15000012454') { $html = << 访客无权限修改 访客无权限修改! HTML; echo $html; exit; } $Data = I(); $cl_time = Date('Y-m-d H:i:s'); if (!empty($_SESSION['idphone'])) { $Data['clr'] = $_SESSION['idphone']; } if (!empty($_SESSION['phone'])) { $Data['clr'] = $_SESSION['phone']; } if ($Data['plcl'] == 1)// { $ResData = ytapi_query("select * from person_data where artificial_code='" . $Data['artificial_code'] . "' and clzt=0 LIMIT 1"); $res_u = ytapi_insert("update person_data set clzt=1,clnr='" . $Data['clnr'] . "',clr_phone='" . $Data['clr'] . "',cl_time='" . $cl_time . "' where artificial_code='" . $Data['artificial_code'] . "' and clzt=0"); $data = [ 'sign' => $ResData[0]['sign'], 'artificial_id' => $ResData[0]['artificial_id'], 'artificial_code' => $ResData[0]['artificial_code'], 'pid' => $ResData[0]['pid'], 'status' => $ResData[0]['status'], 'content' => $ResData[0]['content'], ]; $url = 'http://47.98.201.187:55335/report'; $data = json_encode($data); // $result = http_post_advertise($url,$data); } else { $res_u = ytapi_insert("update person_data set clzt=1,clnr='" . $Data['clnr'] . "',clr_phone='" . $Data['clr'] . "',cl_time='" . $cl_time . "' where id=" . $Data['id']); $ResData = ytapi_query("select * from person_data where id=" . $Data['id']); // $Data['companyid']=10209; if ($Data['companyid'] == 10209 || $Data['companyid'] == 10198 || $Data['companyid'] == 10195 || $Data['companyid'] == 10078 || $Data['companyid'] == 10069 || $Data['companyid'] == 10083 || $Data['companyid'] == 10064 || $Data['companyid'] == 10067 || $Data['companyid'] == 10215 || $Data['companyid'] == 10216 || $Data['companyid'] == 10214 || $Data['companyid'] == 10212 || $Data['companyid'] == 10206 || $Data['companyid'] == 10114 || $Data['companyid'] == 10077 || $Data['companyid'] == 10122 || $Data['companyid'] == 10074 || $Data['companyid'] == 10076 || $Data['companyid'] == 10079 || $Data['companyid'] == 10066 || $Data['companyid'] == 10065 || $Data['companyid'] == 10070 || $Data['companyid'] == 10063) { $area_status = 2; } elseif ($Data['companyid'] == 10113 || $Data['companyid'] == 10012) { $area_status = 1; } $data = [ "SubType" => '999', // 'sign'=>$ResData[0]['sign'], 'artificial_id' => $ResData[0]['artificial_id'], 'reason' => $ResData[0]['clnr'], 'handler' => $ResData[0]['clr_phone'], 'mobile' => $ResData[0]['clr_phone'], 'area_status' => $area_status, ]; // print_r($data); // exit(); $url = 'http://47.98.201.187:55335/report'; $data = json_encode($data); $result = http_post_advertise($url, $data); } $resurl = 'http://' . $_SERVER['SERVER_NAME'] . $Data['url']; $html = << 保存成功 保存成功,正在跳转。。。 HTML; echo $html; //echo json_encode($arr) ; } //电子督察单提交 public function outputs1() { if ($_SESSION['phone'] == '15000012454' || $_SESSION['idphone'] == '15000012454') { $html = << 访客无权限修改 访客无权限修改! HTML; echo $html; exit; } $Data = I(); $cl_time = Date('Y-m-d H:i:s'); if (!empty($_SESSION['idphone'])) { $Data['clr'] = $_SESSION['idphone']; } if (!empty($_SESSION['phone'])) { $Data['clr'] = $_SESSION['phone']; } // print_r("update jingan_analysis_data set clzt=1,clnr='" . $Data['clnr'] . "',cl_phone='" . $Data['clr'] . "',cl_time='" . $cl_time . "' where id=" . $Data['id']);exit(); $res_u = ytapi_insert("update jingan_analysis_data set clzt=1,clnr='" . $Data['clnr'] . "',cl_phone='" . $Data['clr'] . "',cl_time='" . $cl_time . "' where id=" . $Data['id']); $ResData = ytapi_query("select * from jingan_analysis_data where id=" . $Data['id']); // $Data['companyid']=10209; if ($Data['companyid'] == 10209 || $Data['companyid'] == 10198 || $Data['companyid'] == 10195 || $Data['companyid'] == 10078 || $Data['companyid'] == 10069 || $Data['companyid'] == 10083 || $Data['companyid'] == 10064 || $Data['companyid'] == 10067 || $Data['companyid'] == 10215 || $Data['companyid'] == 10216 || $Data['companyid'] == 10214 || $Data['companyid'] == 10212 || $Data['companyid'] == 10206 || $Data['companyid'] == 10114 || $Data['companyid'] == 10077 || $Data['companyid'] == 10122 || $Data['companyid'] == 10074 || $Data['companyid'] == 10076 || $Data['companyid'] == 10079 || $Data['companyid'] == 10066 || $Data['companyid'] == 10065 || $Data['companyid'] == 10070 || $Data['companyid'] == 10063) { $area_status = 2; } elseif ($Data['companyid'] == 10113 || $Data['companyid'] == 10012) { $area_status = 1; } $data = [ "SubType" => $Data['SubType'], 'artificial_id' => $ResData[0]['supervise_id'], 'reason' => $ResData[0]['clnr'], 'handler' => $ResData[0]['cl_phone'], 'mobile' => $ResData[0]['cl_phone'], 'area_status' => $area_status, ]; // $url="http://iot.usky.cn:80/ytapi/admin/order/aepceshi"; $url = 'http://47.98.201.187:55335/report'; $data = json_encode($data); $result = http_post_advertise($url, $data); $resurl = 'http://' . $_SERVER['SERVER_NAME'] . $Data['url']; $html = << 保存成功 保存成功,正在跳转。。。 HTML; echo $html; //echo json_encode($arr) ; } }