LikeModel.class.php
1005 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
/**
* 考试-标签信息表
* @author: houyingcai
* @date : 2017-05-19 18:06:47
*/
namespace Common\Model;
class LikeModel extends AbstractModel
{
/**
* 构造方法
*/
public function __construct()
{
parent::__construct();
}
/**
* 根据答卷ID进行分组查询点赞记录
* @autor 蔡建华
*
* @param array $ea_ids 答卷id集合
* @param string $fields 返回字段
*
* @return array
*/
public function getLikeCount($ea_ids = [], $fields = '*')
{
// 组装查询语句
$where = 'status <? AND domain=?';
// 操作状态和域名
$params[] = LikeModel::ST_DELETE;
$params[] = QY_DOMAIN;
if (!empty($ea_ids)) {
$where .= ' and ea_id in(?)';
$params[] = $ea_ids;
}
$sql = 'SELECT ' . $fields . ' FROM __TABLE__ WHERE ' . $where . 'GROUP BY ea_id';
return $this->_m->fetch_array($sql, $params);
}
}