getDeviceCode($Data['companyid'],"1,3"); if (!empty($device_code_list)){ $ResData=M()->query("SELECT count(*) as hj FROM sp_hj2017 where device_code in(".$device_code_list.") and clzt='0'"); }else{ $ResData[0]['hj']= 0; } // $ResData=M()->query("SELECT count(a.id) as hj FROM sp_hj2017 as a join sp_owner as b ON a.device_code=b.owner_code WHERE b.dwtype in(1,3) and b.company='".$Map['company']."' and a.clzt='0'"); $this->assign('wcl', $ResData[0]['hj']); $this->assign('companyid', $Data['companyid']); $this->display('Index/fire'); } public function change() { $Data = I(''); $Map['company'] = $Data['companyid']; switch ($Data['type']) { case 'untreated': $Map['clzt'] = 0; $where=" and a.clzt='0' "; break; case 'treated': $Map['clzt'] = 1; $where=" and a.clzt='1' "; break; default: break; } $ResData = M()->query("select a.data2 as ftype , a.time ,b.owner_name as owner_name ,a.clzt as clzt ,a.id as id ,a.data4 as data4 from sp_hj2017 as a join sp_owner as b ON a.device_code=b.owner_code WHERE b.dwtype in(1,3) and b.company='".$Map['company']."' ".$where." order by a.id desc limit 500"); // $ResData = M('v_hj2017_2')->where($Map)->order("time desc")->limit(500)->select(); //print_r($ResData);exit(); $this->assign('ResData', $ResData); $this->display('Index/fire-list'); } //获取设备编号 public function getDeviceCode($company,$dwtype) { $device = M()->query("SELECT owner_code FROM sp_owner WHERE company in(".$company.") and dwtype in(".$dwtype.")"); $str = ""; foreach ($device as $val) { $str .= "'" . $val['owner_code'] . "',"; } $newstr = substr($str, 0, strlen($str) - 1); return $newstr; } //无用 public function change1() { $Data = I(''); $Map['company'] = $Data['companyid']; $type = $Data['type']; switch ($type) { case 'untreated': $ResData = M()->query("select sp_hj2017.time, sp_hj2017.data2, sp_owner.owner_name, sp_hj2017.clzt, sp_hj2017.id, sp_hj2017.data4 from sp_owner join sp_hj2017 on sp_owner.owner_code=sp_hj2017.device_code where company=" . $Map['company'] . " and clzt=0 order by time desc limit 500"); break; case 'treated': $ResData = M()->query("select sp_hj2017.time, sp_hj2017.data2, sp_owner.owner_name, sp_hj2017.clzt, sp_hj2017.id, sp_hj2017.data4 from sp_owner join sp_hj2017 on sp_owner.owner_code=sp_hj2017.device_code where company=" . $Map['company'] . " and clzt=1 order by time desc limit 500"); break; default: $ResData = M()->query("select sp_hj2017.time, sp_hj2017.data2, sp_owner.owner_name, sp_hj2017.clzt, sp_hj2017.id, sp_hj2017.data4 from sp_owner join sp_hj2017 on sp_owner.owner_code=sp_hj2017.device_code where company=" . $Map['company'] . " order by time desc limit 500"); break; } $this->assign('ResData', $ResData); $this->display('Index/fire-list'); } } ?>