RankingController.class.php
1.08 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
<?php
/**
* 获取指定用户的积分排名.
*
* @auther gaoyaqiu
* @date 2017/05/24
*/
namespace Api\Controller\Integral;
use Common\Common\Department;
use VcySDK\Integral;
use VcySDK\Service;
class RankingController extends AbstractController
{
public function index()
{
// 获取排行数据
$sdk = new Integral(Service::instance());
$rankingParams = [
'memUid' => $this->uid,
'rankingType' => I('post.ranking_type', $sdk::INTEGRAL_RANKING_TYPE_TOTAL),
];
// 如果部门等于-1时,表示全公司
$dpId = I('post.dp_id', -1);
if ($dpId != -1) {
$department = new Department();
// 获取所有子部门,包含自己
$deps = $department->list_childrens_by_cdid($dpId, true);
$rankingParams['dpIds'] = empty(array_keys($deps)) ? [] : array_keys($deps);
}
// 获取 角色/岗位 筛选条件
$this->getRankingFilterCond($rankingParams);
$this->_result = $sdk->getRanking($rankingParams);
return true;
}
}