LikeModel.class.php
939 Bytes
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
/**
* 同事圈以及评论点赞信息表
* User: 代军
* Date: 2017-04-24
*/
namespace Common\Model;
class LikeModel extends AbstractModel
{
/**
* 构造方法
*/
public function __construct()
{
parent::__construct();
}
public function get_like_total($ids, $page_option = null, $order_option = [])
{
$where = ' domain=? AND status<? AND cid in(?) ';
$params = array(QY_DOMAIN, self::ST_DELETE, $ids);
$sql = 'SELECT cid, COUNT( * ) as total FROM __TABLE__ WHERE ' . $where . " GROUP BY cid ";
// 分页参数
$limit = '';
if (!$this->_limit($limit, $page_option)) {
return false;
}
// 排序
$order_by = '';
if (!$this->_order_by($order_by, $order_option)) {
return false;
}
return $this->_m->fetch_array($sql . $order_by . $limit, $params);
}
}