12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- namespace Home\Controller;
- use Think\Controller;
- //include '../Common/function.php';
- class FireHydrantController extends ComController {
- public function index()
- {
- $Data=I();
- $ResData=M()->query("SELECT count(a.id) as sl FROM sp_sj2017 a JOIN sp_owner b ON a.device_code=b.owner_code WHERE b.company=".$Data['companyid']." AND b.dwtype='4' and a.clzt=0;");
- $this->assign('wcl',$ResData[0]['sl']);
- $this->assign('companyid',$Data['companyid']);
- $this->display('Index/fire_hydrant');
- }
- public function change()
- {
- $Data=I('');
- // print_r($Data);exit();
- $page = $Data['page'];
- $size = 20;
- $startpage=($page - 1) * 20;
- switch ($Data['type'])
- {
- case 'untreated':
- $sql = "select a.id,a.data1,a.time,b.owner_name,a.clzt from sp_sj2017 a join sp_owner b on a.device_code=b.owner_code where b.company=".$Data['companyid']." and b.dwtype='4' and a.clzt=0 order by time desc limit ".$startpage.",".$size;
- break;
- case 'treated':
- $sql = "select a.id,a.data1,a.time,b.owner_name,a.clzt from sp_sj2017 a join sp_owner b on a.device_code=b.owner_code where b.company=".$Data['companyid']." and b.dwtype='4' and a.clzt=1 order by time desc limit ".$startpage.",".$size;
- break;
- default:
- $sql = "select a.id,a.data1,a.time,b.owner_name,a.clzt from sp_sj2017 a join sp_owner b on a.device_code=b.owner_code where b.company=".$Data['companyid']." and b.dwtype='4' order by time desc limit ".$startpage.",".$size;
- break;
- }
- // print_r($sql);exit();
- $ResData=M()->query($sql);
- // print_r($ResData);exit();
- // $this->assign('ResData',$ResData);
- // $this->display('Index/fire_hydrant-list');
- // $ResData[0]['totalCount'] = count($ResData);
- echo json_encode($ResData);
- }
- }
- ?>
|