CommentModel.class.php
2.11 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
namespace Common\Model;
class CommentModel extends AbstractModel
{
/**
* 构造方法
*/
public function __construct()
{
parent::__construct();
}
/**
* 获取活动已参与列表数
* @author xtong
* @param array $conds 条件
* @return array
*/
public function count_join($conds = [])
{
$wheres = [];
$params = [];
if (is_array($conds) && !empty($conds)) {
$this->_parse_where($wheres, $params, $conds);
}
// 企业标记
$wheres[] = "`{$this->prefield}domain`=?";
$params[] = QY_DOMAIN;
// 状态条件
$wheres[] = "`{$this->prefield}status`<?";
$params[] = $this->get_st_delete();
$wheres_sql = implode(' AND ', $wheres);
$sql = "SELECT COUNT(`uid`) total FROM __TABLE__ WHERE {$wheres_sql} GROUP BY `uid`";
return count($this->_m->fetch_array($sql, $params));
}
/**
* 获取活动已参与列表
* @author xtong
* @param array $conds 条件
* @param array $page_option 分页参数
* @param array $order_option 排序参数
* @return array
*/
public function list_join($conds = [],$page_option=[], $order_option=[])
{
$wheres = [];
$params = [];
// 排序
$orderby = '';
if (!$this->_order_by($orderby, $order_option)) {
return false;
}
// 分页参数
$limit = '';
if (!$this->_limit($limit, $page_option)) {
return false;
}
if (is_array($conds) && !empty($conds)) {
$this->_parse_where($wheres, $params, $conds);
}
// 企业标记
$wheres[] = "`{$this->prefield}domain`=?";
$params[] = QY_DOMAIN;
// 状态条件
$wheres[] = "`{$this->prefield}status`<?";
$params[] = $this->get_st_delete();
$wheres_sql = implode(' AND ', $wheres);
$sql = "SELECT `uid`,`created` FROM __TABLE__ WHERE {$wheres_sql} GROUP BY `uid` {$orderby}{$limit}";
return $this->_m->fetch_array($sql, $params);
}
}