RightModel.class.php
1.54 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
<?php
namespace Common\Model;
class RightModel extends AbstractModel
{
/**
* 构造方法
*/
public function __construct()
{
parent::__construct();
}
/**
* 获取人员有权限参与的的活动列表
*
* @param string $uid 用户uid
* @param array $dpIds 用户部门(包含父部门)集合
* @param string $jobId 用户岗位id
* @param string $roleId 用户角色id
* @param array $tagId 用户标签id
*
* @return array
*/
public function get_right_look_activity_list($uid = '', $dpIds = [], $jobId = '', $roleId = '', $tagId = [])
{
// 组装查询语句
$where = ' status<' . self::ST_DELETE . " AND domain= '" . QY_DOMAIN . "' AND r_type=0 ";
// 如果岗位ID存在
if (!empty($jobId)) {
$jobId_where = " OR job_id='" . $jobId . "'";
}
// 如果角色ID存在
if (!empty($roleId)) {
$roleId_where = " OR role_id='" . $roleId . "'";
}
if (!empty($dpIds)) {
$dps = implode(',', $dpIds);
$dp_sql = " OR dp_id IN('" . $dps . "')";
}
if (!empty($tagId)) {
$tags = implode(',', $tagId);
$tag_sql = " OR tag_id IN('" . $tags . "')";
}
$where .= " AND ( uid= '" . $uid . "'" . $dp_sql . $jobId_where . $roleId_where . $tag_sql . " ) ";
$sql = "SELECT ac_id FROM __TABLE__ WHERE " . $where;
// 读取记录
return $this->_m->fetch_array($sql, []);
}
}