FireHydrantController.class.php.bak.2022-01-27 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace Home\Controller;
  3. use Think\Controller;
  4. //include '../Common/function.php';
  5. class FireHydrantController extends ComController {
  6. public function index()
  7. {
  8. $Data=I();
  9. $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;");
  10. $this->assign('wcl',$ResData[0]['sl']);
  11. $this->assign('companyid',$Data['companyid']);
  12. $this->display('Index/fire_hydrant');
  13. }
  14. public function change()
  15. {
  16. $Data=I('');
  17. // print_r($Data);exit();
  18. switch ($Data['type'])
  19. {
  20. case 'untreated':
  21. $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";
  22. break;
  23. case 'treated':
  24. $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";
  25. break;
  26. default:
  27. $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";
  28. break;
  29. }
  30. // print_r($sql);exit();
  31. $ResData=M()->query($sql);
  32. // print_r($ResData);exit();
  33. $this->assign('ResData',$ResData);
  34. $this->display('Index/fire_hydrant-list');
  35. }
  36. }
  37. ?>