123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382 |
- <?php
- namespace Home\Controller;
- use Think\Controller;
- include '../Common/function.php';
- class FireInspectorController extends ComController
- {
- public function catalog()
- {
- $Data = I();
- // print_r($Data);
- $this->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
- <!doctype html>
- <html lang="en">
- <head>
- <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
- <meta charset="utf-8">
- <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
- <meta content="yes" name="apple-mobile-web-app-capable">
- <meta content="black" name="apple-mobile-web-app-status-bar-style">
- <meta content="telephone=no" name="format-detection">
- <title>访客无权限修改</title>
- </head>
- <body>
- 访客无权限修改!
- </body>
- </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
- <!doctype html>
- <html lang="en">
- <head>
- <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
- <meta charset="utf-8">
- <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
- <meta content="yes" name="apple-mobile-web-app-capable">
- <meta content="black" name="apple-mobile-web-app-status-bar-style">
- <meta content="telephone=no" name="format-detection">
- <meta http-equiv="refresh" content="2;url=$resurl" />
- <title>保存成功</title>
- </head>
- <body>
- 保存成功,正在跳转。。。
- </body>
- </html>
- HTML;
- echo $html;
- //echo json_encode($arr) ;
- }
- //电子督察单提交
- public function outputs1()
- {
- if ($_SESSION['phone'] == '15000012454' || $_SESSION['idphone'] == '15000012454') {
- $html = <<<HTML
- <!doctype html>
- <html lang="en">
- <head>
- <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
- <meta charset="utf-8">
- <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
- <meta content="yes" name="apple-mobile-web-app-capable">
- <meta content="black" name="apple-mobile-web-app-status-bar-style">
- <meta content="telephone=no" name="format-detection">
- <title>访客无权限修改</title>
- </head>
- <body>
- 访客无权限修改!
- </body>
- </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
- <!doctype html>
- <html lang="en">
- <head>
- <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
- <meta charset="utf-8">
- <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
- <meta content="yes" name="apple-mobile-web-app-capable">
- <meta content="black" name="apple-mobile-web-app-status-bar-style">
- <meta content="telephone=no" name="format-detection">
- <meta http-equiv="refresh" content="2;url=$resurl" />
- <title>保存成功</title>
- </head>
- <body>
- 保存成功,正在跳转。。。
- </body>
- </html>
- HTML;
- echo $html;
- //echo json_encode($arr) ;
- }
- }
|