PublicController.class.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <?php
  2. namespace Home\Controller;
  3. use Think\Controller;
  4. include '../Common/function.php';
  5. class PublicController extends Controller
  6. {
  7. public function index()
  8. {
  9. $this->display();
  10. }
  11. public function comway()
  12. {
  13. $Data = I('cate_text');
  14. $this->assign('ResData', $Data);
  15. $this->display('Public/success');
  16. }
  17. public function Mainfback()
  18. {
  19. $Data = I('');
  20. if (IS_POST) {
  21. $Data['datetime'] = date('Y-m-d H:i:s');
  22. $Res = M('wx_suggest')->add($Data);
  23. if ($Res) {
  24. $Text = '非常感谢您对我们的关注和支持,我们将认真对待您提出的宝贵建议,如我们公司采纳了您的建议,将会给予您快递一份小礼品';
  25. $this->redirect('Public/comway', array('cate_text' => $Text));
  26. }
  27. } else {
  28. $this->assign('openid', $_SESSION['useropenid']);
  29. $this->assign('action', '/home/Public/Mainfback');
  30. }
  31. $this->display('Public/mainfback');
  32. }
  33. public function Profback()
  34. {
  35. $Data = I('');
  36. if (IS_POST) {
  37. $Data['datetime'] = date('Y-m-d H:i:s');
  38. $Res = M('wx_complaint')->add($Data);
  39. if ($Res) {
  40. $Text = '感谢您的投诉,我们将尽快给予您的答复';
  41. $this->redirect('Public/comway', array('cate_text' => $Text));
  42. //$this->display('Public/success');
  43. }
  44. } else {
  45. $this->assign('openid', $_SESSION['useropenid']);
  46. $this->assign('action', '/home/Public/Profback');
  47. }
  48. $this->display('Public/Profback');
  49. }
  50. public function change()
  51. {
  52. // $Data = I('');
  53. // $company = $Data['companyid'];
  54. // $type = $Data['type'];
  55. // $ResData = indexTwo($company,$type);
  56. // $this->assign('ResData',$ResData);
  57. // $this->display('Index/water-list');
  58. $Data = I('');
  59. $Map['company'] = $Data['companyid'];
  60. $page = $Data['page'];
  61. $size = 20;
  62. $startpage = ($page - 1) * 20;
  63. $limit = $startpage . ',' . $size;
  64. // $Map['dwtype']='2';
  65. switch ($Data['type']) {
  66. case 'untreated':
  67. $Map['clzt'] = 0;
  68. break;
  69. case 'treated':
  70. $Map['clzt'] = 1;
  71. break;
  72. default:
  73. break;
  74. }
  75. $ResData = M('v_sj2017_2')->where($Map)->order("time desc")->limit($limit)->select();
  76. //print_r($ResData);exit();
  77. // $this->assign('ResData', $ResData);
  78. // $this->display('Index/water-list');
  79. echo json_encode($ResData);
  80. }
  81. public function change1()
  82. {
  83. // $Data = I('');
  84. // $company = $Data['companyid'];
  85. // $type = $Data['type'];
  86. // $ResData = indexTwo($company,$type);
  87. // $this->assign('ResData',$ResData);
  88. // $this->display('Index/water-list');
  89. $Data = I('');
  90. $page = $Data['page'];
  91. $size = 20;
  92. $startpage = ($page - 1) * 20;
  93. $Map['company'] = $Data['companyid'];
  94. switch ($Data['type']) {
  95. case 'untreated':
  96. $Map['clzt'] = 0;
  97. $ResData = M()->query("select a.id,a.time,a.data4,b.owner_name,a.clzt from sp_lifter2017 as a join sp_owner as b on a.device_code=b.owner_code where b.company=" . $Data['companyid'] . " and a.clzt=0 order by a.time desc limit " . $startpage . "," . $size);
  98. break;
  99. case 'treated':
  100. $Map['clzt'] = 1;
  101. $ResData = M()->query("select a.id,a.time,a.data4,b.owner_name,a.clzt from sp_lifter2017 as a join sp_owner as b on a.device_code=b.owner_code where b.company=" . $Data['companyid'] . " and a.clzt=1 order by a.time desc limit " . $startpage . "," . $size);
  102. break;
  103. default:
  104. $ResData = M()->query("select a.id,a.time,a.data4,b.owner_name,a.clzt from sp_lifter2017 as a join sp_owner as b on a.device_code=b.owner_code where b.company=" . $Data['companyid'] . " order by a.time desc limit " . $startpage . "," . $size);
  105. // print_r("select * from sp_lifter2017 as a join sp_owner as b on a.device_code=b.owner_code where b.company=".$Data['companyid']." order by a.time desc limit 1000");
  106. break;
  107. }
  108. // $ResData=M('lifter2017')->where($Map)->order("time desc")->limit(1000)->select();
  109. // print_r($ResData);
  110. // $this->assign('ResData',$ResData);
  111. // $this->display('Index/lifter-list');
  112. echo json_encode($ResData);
  113. }
  114. }