12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
- namespace Home\Controller;
- use Think\Controller;
- class CombustibleGasController extends ComController{
-
-
- public function index()
- {
- $Data=I('');
- $ResData=M()->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'];
- 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 1000");
- 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 1000");
- 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 1000");//." 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']='设备防拆';
- }
- }
- $this->assign('ResData',$ResData);
- $this->display('Index/combustible_gas-list');
- }
-
- }
- ?>
|