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