ColumnModel.class.php
1.29 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
<?php
/**
* Created by PhpStorm.
* User: liyifei2012it
* Date: 17/5/18
* Time: 11:35
*/
namespace Common\Model;
class ColumnModel extends AbstractModel
{
// 构造方法
public function __construct()
{
parent::__construct();
}
/**
* @param array $conds
* @param array $conds 传入条件
* + string startdate 开始日期
* + string enddate 结束日期
* + array uids 用户uid集合
* + array obj_ids 栏目id集合
* @return list
*/
public function list_column_data($conds = array())
{
// 组装查询语句
$where = " status <? AND domain=?";
// 操作状态和域名
$params[] = $this->get_st_delete();
$params[] = QY_DOMAIN;
if (!empty($conds['uids'])) {
$where .= " AND uid in(?)";
$params[] = $conds['uids'];
}
$where .= " AND obj_id in(?)";
$params[] = $conds['obj_ids'];
$where .= " AND created >=? AND created<=?";
$params[] = $conds['starttime'];
$params[] = $conds['endtime'];
$sql = 'SELECT COUNT(*) as total ,obj_id FROM __TABLE__ WHERE ' . $where .' group by obj_id';
return $this->_m->fetch_array($sql, $params);
}
}