display('Index2/selftest'); } public function details_page(){ // echo '我出来了'; $Data = I(''); // print_r($Data); $arr=M()->query("select owner_code,owner_name from sp_owner where company=".$Data['companyid']." and dwtype=6"); $arr_dk=M()->query("select owner_code,ports,ioname,porttype from sp_owner_port where iotype=2 and owner_code='".$arr[0]['owner_code']."' ORDER BY ports asc"); $arr_xs=array(); foreach ($arr_dk as $key=>$value){ // print_r("select data1 from sp_rtu2017 where port='E6' and ncmd like '%".$arr_dk[$key]['ports']."' and device_code='".$arr_dk[$key]['owner_code']."' ORDER BY time desc"); $arr_dk2=M()->query("select data1 from sp_d".$arr_dk[$key]['owner_code']." where port='E6' and ncmd like '%".$arr_dk[$key]['ports']."' ORDER BY time desc"); // print_r("select data1 from sp_d".$arr_dk[$key]['owner_code']." where port='E6' and ncmd like '%".$arr_dk[$key]['ports']."' ORDER BY time desc"); $arr_xs[$key]['owner_code']=$arr_dk[$key]['owner_code']; $arr_xs[$key]['ports']=$arr_dk[$key]['ports']; $arr_xs[$key]['ioname']=$arr_dk[$key]['ioname']; $arr_xs[$key]['porttype']=$arr_dk[$key]['porttype']; if ($arr_dk[$key]['porttype']==1){ $arr_xs[$key]['data1']=$arr_dk2[0]['data1'].'Mpa'; }elseif ($arr_dk[$key]['porttype']==2){ $arr_xs[$key]['data1']=$arr_dk2[0]['data1'].'M'; }elseif ($arr_dk[$key]['porttype']==3){ $arr_xs[$key]['data1']=$arr_dk2[0]['data1'].'℃'; }elseif ($arr_dk[$key]['porttype']==4){ $arr_xs[$key]['data1']=$arr_dk2[0]['data1'].'%'; } } // print_r($arr_xs); $this->assign('owner_name',$arr[0]['owner_name']); $this->assign('arr_xs',$arr_xs); $this->display('Index2/details_page'); } public function call_the_police(){ $Data = I(''); // print_r($Data); $arr=M()->query("select company from sp_owner where owner_code=".$Data['owner_code']." and dwtype=6"); $arr2=M()->query("select ioname from sp_owner_port where iotype=2 and owner_code=".$Data['owner_code']." and ports=".$Data['ports']); $this->assign('a',$arr2[0]); $this->assign('b',$arr[0]); $this->assign('Data',$Data); $this->display('Index2/call_the_police'); } // public function call_the_police(){ // $Data = I(''); // print_r($Data); // $arr=M()->query("select company from sp_owner where owner_code=".$Data['owner_code']." and dwtype=6"); // $arr2=M()->query("select ioname,porttype from sp_owner_port where iotype=2 and owner_code=".$Data['owner_code']." and ports=".$Data['ports']); // $this->assign('a',$arr2[0]); // $this->assign('b',$arr[0]); // $this->assign('Data',$Data); // // if ($Data['pd']==1){ // $arr_dk2=M()->query("select data1,address,data3 from sp_d".$Data['owner_code']." where port='E6' and ncmd like '%".$Data['ports']."' ORDER BY time desc"); //// print_r("select data1,address,data3 from sp_d".$Data['owner_code']." where port='E6' and ncmd like '%".$Data['ports']."' ORDER BY time desc"); // $time= date('Y-m-d H:i:s'); // if($arr2[0]['porttype']==1){ // $data2='高压'; // }elseif ($arr2[0]['porttype']==2){ // $data2='高水位'; // }elseif ($arr2[0]['porttype']==3){ // $data2='高温'; // }elseif ($arr2[0]['porttype']==3){ // $data2='高湿度'; // } // $inset_rtu=M()->query("insert into sp_rtu2017 (port,device_code,time,status,address,ncmd,data1,data2,data3,data4,data5,clsj,clr,clnr,clwb,cllxr,cldh,clzt,cllx,video) values ('E6','" // .$Data['owner_code']."','".$time."','暂时不用','".$arr_dk2[0]['address']."','0".$Data['ports']."','".$arr_dk2[0]['data1']."','".$data2."','".$arr_dk2[0]['address']."','".$arr2[0]['ioname']. // "','暂时不用',0,'暂时不用','暂时不用','暂时不用','暂时不用','暂时不用',0,'暂时不用','暂时不用')"); //// print_r("insert into sp_rtu2017 (port,device_code,time,status,address,ncmd,data1,data2,data3,data4,data5,clsj,clr,clnr,clwb,cllxr,cldh,clzt,cllx,video) values ('E6','" //// .$Data['owner_code']."','".$time."','','".$arr_dk2[0]['address']."','0".$Data['ports']."','".$arr_dk2[0]['data1']."','".$data2."','".$arr_dk2[0]['address']."','".$arr2[0]['ioname']. //// "','',0,'','','','','',0,'','')"); // if ($inset_rtu){ // // } // } // // $this->display('Index2/call_the_police'); // } public function Upper_limit_handle(){//上限报警 $Data = I(''); // print_r($Data); $arr=M()->query("select company from sp_owner where owner_code=".$Data['owner_code']." and dwtype=6"); $arr2=M()->query("select ioname,porttype from sp_owner_port where iotype=2 and owner_code=".$Data['owner_code']." and ports=".$Data['ports']); $this->assign('a',$arr2[0]); $this->assign('b',$arr[0]); $this->assign('Data',$Data); $arr_dk2=M()->query("select data1,address,data3 from sp_d".$Data['owner_code']." where port='E6' and ncmd like '%".$Data['ports']."' ORDER BY time desc"); $time= date('Y-m-d H:i:s'); if($arr2[0]['porttype']==1){ $data2='高压'; }elseif ($arr2[0]['porttype']==2){ $data2='高水位'; }elseif ($arr2[0]['porttype']==3){ $data2='高温'; }elseif ($arr2[0]['porttype']==3){ $data2='高湿度'; } $sql="insert into sp_rtu2017 (port,device_code,time,address,ncmd,data1,data2,data3,data4,clsj) values ('E6','" .$Data['owner_code']."','".$time."','".$arr_dk2[0]['address']."','0".$Data['ports']."','".$arr_dk2[0]['data1']."','".$data2."','".$arr_dk2[0]['address']."','".$arr2[0]['ioname']. "',0)"; $inset_rtu=add88($sql); // $inset_rtu=M()->query("insert into sp_rtu2017 (port,device_code,time,address,ncmd,data1,data2,data3,data4,clsj) values ('E6','" // .$Data['owner_code']."','".$time."','".$arr_dk2[0]['address']."','0".$Data['ports']."','".$arr_dk2[0]['data1']."','".$data2."','".$arr_dk2[0]['address']."','".$arr2[0]['ioname']. // "',0)"); if ($inset_rtu){ $url="https://qhome.usky.cn/jdxf/wxapp2.php/Home/Rtuwarn/message_sendalarm"; $param = array( "id"=>$Data['owner_code'], "types"=>$data2, "insert_id"=>'', "phone"=>'', "time"=>$time ); wxts($url,$param); } $this->display('Index2/call_the_police'); } public function lower_limit_handle(){//下限报警 $Data = I(''); // print_r($Data); $arr=M()->query("select company from sp_owner where owner_code=".$Data['owner_code']." and dwtype=6"); $arr2=M()->query("select ioname,porttype from sp_owner_port where iotype=2 and owner_code=".$Data['owner_code']." and ports=".$Data['ports']); $this->assign('a',$arr2[0]); $this->assign('b',$arr[0]); $this->assign('Data',$Data); $arr_dk2=M()->query("select data1,address,data3 from sp_d".$Data['owner_code']." where port='E6' and ncmd like '%".$Data['ports']."' ORDER BY time desc"); $time= date('Y-m-d H:i:s'); if($arr2[0]['porttype']==1){ $data2='低压'; }elseif ($arr2[0]['porttype']==2){ $data2='低水位'; }elseif ($arr2[0]['porttype']==3){ $data2='低温'; }elseif ($arr2[0]['porttype']==3){ $data2='低湿度'; } $sql="insert into sp_rtu2017 (port,device_code,time,address,ncmd,data1,data2,data3,data4,clsj) values ('E6','" .$Data['owner_code']."','".$time."','".$arr_dk2[0]['address']."','0".$Data['ports']."','".$arr_dk2[0]['data1']."','".$data2."','".$arr_dk2[0]['address']."','".$arr2[0]['ioname']. "',0)"; $inset_rtu=add88($sql); if ($inset_rtu){ $url="https://qhome.usky.cn/jdxf/wxapp2.php/Home/Rtuwarn/message_sendalarm"; $param = array( "id"=>$Data['owner_code'], "types"=>$data2, "insert_id"=>'', "phone"=>'', "time"=>$time ); wxts($url,$param); } $this->display('Index2/call_the_police'); } }