query("SELECT count(*) FROM sp_gas2020 a JOIN sp_owner b ON device_code=owner_code WHERE b.company=".$Data['companyid']." AND b.dwtype=131 and clzt=0;"); $this->assign('gassl',$ResData); $this->assign('companyid',$Data['companyid']); $this->display('Index/combustible_gas_system'); } public function change() { $Data=I(''); $Map['company']=$Data['companyid']; $page = $Data['page']; $size = 20; $startpage=($page - 1) * 20; switch ($Data['type']) { case 'untreated': $Map['clzt']=0; $ResData=M()->query("select a.id,a.device_code,a.data1,a.clzt,a.time,d.owner_name from sp_gas2020 a join sp_owner d ON a.device_code=d.owner_code where company=".$Map['company']." AND clzt=".$Map['clzt']." order by a.time desc limit ".$startpage.",".$size); break; case 'treated': $Map['clzt']=1; $ResData=M()->query("select a.id,a.device_code,a.data1,a.clzt,a.time,d.owner_name from sp_gas2020 a join sp_owner d ON a.device_code=d.owner_code where company=".$Map['company']." AND clzt=".$Map['clzt']." order by a.time desc limit ".$startpage.",".$size); break; default: $ResData=M()->query("select a.id,a.device_code,a.data1,a.clzt,a.time,d.owner_name from sp_gas2020 a join sp_owner d ON a.device_code=d.owner_code where company=".$Map['company']." order by a.time desc limit ".$startpage.",".$size);//." and data1!='EF9'" break; } foreach ($ResData as $key=>$value){ if ($ResData[$key]['data1']=='GS01'){ $ResData[$key]['wtype']='可燃气体告警'; }elseif ($ResData[$key]['data1']=='GS02'){ $ResData[$key]['wtype']='电池电量低'; }elseif ($ResData[$key]['data1']=='GS03'){ $ResData[$key]['wtype']='设备防拆'; } } echo json_encode($ResData); // $this->assign('ResData',$ResData); // $this->display('Index/combustible_gas-list'); } } ?>