UserActionModel.class.php
856 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
<?php
/**
* Created by PhpStorm.
* User: tangxingguo
* Date: 2017/4/12
* Time: 10:32
*/
namespace Common\Model;
class UserActionModel extends AbstractModel
{
// 构造方法
public function __construct()
{
parent::__construct();
}
/**
* 获取用户行为总数
* @author tangxingguo
* @param string $uid 用户ID
* @param string $action_key 行为key
* @return int
*/
public function countByActionKey($uid, $action_key)
{
$sql = "SELECT COUNT(distinct data_id) FROM __TABLE__ WHERE `uid` = ? AND `action_key` = ? AND `domain` = ? AND status < ?";
$params = [
$uid,
$action_key,
QY_DOMAIN,
$this->get_st_delete(),
];
$count = $this->_m->result($sql, $params);
return intval($count);
}
}