qrcode.table.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. defined('IN_IA') or exit('Access Denied');
  7. class QrcodeTable extends We7Table {
  8. public function searchTime($start_time, $end_time) {
  9. $this->query->where('createtime >=', $start_time)->where('createtime <=', $end_time);
  10. return $this;
  11. }
  12. public function searchKeyword($keyword) {
  13. $this->query->where('name LIKE', "%{$keyword}%");
  14. return $this;
  15. }
  16. public function qrcodeStaticList($status) {
  17. global $_W;
  18. $this->query->from('qrcode_stat')->where('uniacid', $_W['uniacid'])->where('acid', $_W['acid']);
  19. if (!empty($status)) {
  20. $this->query->groupby('qid');
  21. $this->query->groupby('openid');
  22. $this->query->groupby('type');
  23. }
  24. $this->query->orderby('createtime', 'DESC');
  25. return $this->query->getall();
  26. }
  27. public function qrcodeCount($status) {
  28. global $_W;
  29. $this->query->from('qrcode_stat')->select('count(*) as count')->where('uniacid', $_W['uniacid'])->where('acid', $_W['acid']);
  30. if (!empty($status)) {
  31. $this->query->groupby('qid');
  32. $this->query->groupby('openid');
  33. $this->query->groupby('type');
  34. }
  35. $count = $this->query->getall();
  36. if ($status) {
  37. return count($count);
  38. }
  39. return $count[0]['count'];
  40. }
  41. }