FireController.class.php.bak.2021-12-20 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace Home\Controller;
  3. use Think\Controller;
  4. //include '../Common/function.php';
  5. class FireController extends ComController
  6. {
  7. public function index()
  8. {
  9. $Data = I();
  10. $Map['company'] = $Data['companyid'];
  11. $Map['clzt'] = 0;
  12. $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.company='".$Map['company']."' and a.clzt='0'");
  13. $this->assign('wcl', $ResData[0]['hj']);
  14. $this->assign('companyid', $Data['companyid']);
  15. $this->display('Index/fire');
  16. }
  17. public function change()
  18. {
  19. $Data = I('');
  20. $Map['company'] = $Data['companyid'];
  21. switch ($Data['type']) {
  22. case 'untreated':
  23. $Map['clzt'] = 0;
  24. $where=" and a.clzt='0' ";
  25. break;
  26. case 'treated':
  27. $Map['clzt'] = 1;
  28. $where=" and a.clzt='1' ";
  29. break;
  30. default:
  31. break;
  32. }
  33. $ResData = M()->query("select a.data2 as ftype , a.time as 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.company='".$Map['company']."' ".$where." order by a.id desc limit 500");
  34. // $ResData = M('v_hj2017_2')->where($Map)->order("time desc")->limit(500)->select();
  35. //print_r($ResData);exit();
  36. $this->assign('ResData', $ResData);
  37. $this->display('Index/fire-list');
  38. }
  39. //无用
  40. public function change1()
  41. {
  42. $Data = I('');
  43. $Map['company'] = $Data['companyid'];
  44. $type = $Data['type'];
  45. switch ($type) {
  46. case 'untreated':
  47. $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");
  48. break;
  49. case 'treated':
  50. $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");
  51. break;
  52. default:
  53. $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");
  54. break;
  55. }
  56. $this->assign('ResData', $ResData);
  57. $this->display('Index/fire-list');
  58. }
  59. }
  60. ?>