1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?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();
- 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 1000";
- 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 1000";
- 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 1000";
- break;
- }
- // print_r($sql);exit();
- $ResData=M()->query($sql);
- // print_r($ResData);exit();
- $this->assign('ResData',$ResData);
- $this->display('Index/fire_hydrant-list');
- }
- }
- ?>
|