WaterController.class.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace Home\Controller;
  3. use Think\Controller;
  4. include '../Common/function.php';
  5. class WaterController extends ComController{
  6. public function index()
  7. {
  8. // echo $_SESSION['phone'];
  9. // echo "<br/>....";
  10. // echo $_SESSION['idphone'];
  11. $Data = I('');
  12. $Map['company']=$Data['companyid'];
  13. $Map['clzt']=0;
  14. // $Map['dwtype']=2;
  15. $ResData=M('v_sj2017_2')->where($Map)->count('id');
  16. // $ResData = indexOne($company);
  17. // print_r($ResData);
  18. $this->assign('wjcn',$ResData);
  19. $this->assign('companyid',$Data['companyid']);
  20. $this->display('Index/water_system');
  21. }
  22. public function change()
  23. {
  24. $Data=I('');
  25. $Map['company']=$Data['companyid'];
  26. switch ($Data['type'])
  27. {
  28. case 'untreated':
  29. $Map['clzt']=0;
  30. break;
  31. case 'treated':
  32. $Map['clzt']=1;
  33. break;
  34. default:
  35. break;
  36. }
  37. $ResData=M()->query("select a.id,a.device_code,a.data1,a.clzt,a.time,d.owner_name from sp_ef2017 a join sp_owner d ON a.device_code=d.owner_code where company=".$Map['company']." AND clzt=".$Map['clzt']." and d.dwtype=2");
  38. // $ResData=M('v_ef2017')->where($Map)->order('time desc')->select();
  39. foreach ($ResData as $key=>$value){
  40. if ($ResData[$key]['data1']!='EF9'){
  41. $ResData[$key]['wtype']='在线';
  42. }
  43. }
  44. $this->assign('ResData',$ResData);
  45. // s_print($ResData);
  46. $this->display('Index/efire-list');
  47. }
  48. //public function change()
  49. // {
  50. // $Data = I('');
  51. // $company = $Data['companyid'];
  52. // $type = $Data['type'];
  53. //
  54. // $ResData = indexTwo($company,$type);
  55. //// print_r($ResData);exit();
  56. // $this->assign('ResData',$ResData);
  57. // $this->display('Index/water-list');
  58. // }
  59. }
  60. ?>