UserInfoController.class.php
1.81 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
<?php
/**
* Created by IntelliJ IDEA.
* 勋章人员详情接口
* User: zhoutao
* Reader: zhoutao 2017-05-31 10:07:35
* Date: 2017-05-24 15:43:49
*/
namespace Apicp\Controller\Medal;
use Com\PackageValidate;
use Common\Common\Department;
use Common\Common\User;
class UserInfoController extends AbstractController
{
/**
* UserInfo
* @author tangxingguo
* @desc 勋章人员详情接口
* @param String uid:true 人员ID
* @return Array
array(
'uid' => 'A2FA60EC7F0000017114E2151FC4F2BC', // 人员ID
'username' => '张三', // 人员姓名
'face' => 'http://p.qlogo.cn/bizmail/rRw4pgDZ0aKDFquzJgfY6ZhpCUL4LKm258CMYHy1SU7rUD1ed8KRhw/0',// 头像
'departmentPath' => '畅移(上海)员圈/小花专用部门',// 组织路径
'job' => '运营经理',// 岗位
'role' => '渣渣',// 角色
);
*/
public function index()
{
$rules = [
'uid' => 'require',
];
// 验证请求数据
$validate = new PackageValidate($rules, [], array_keys($rules));
$uid = $validate->postData['uid'];
// 取人员信息
$userInfo = &User::instance()->getByUid($uid);
// 组织路径
$departmentPath = '';
if (!empty($userInfo['dpName'][0]['dpId'])) {
$departmentPath = Department::instance()->getCdNames($userInfo['dpName'][0]['dpId']);
}
$this->_result = [
'uid' => $userInfo['memUid'],
'username' => $userInfo['memUsername'],
'face' => $userInfo['memFace'],
'departmentPath' => $departmentPath,
'job' => $userInfo['memJob'],
'role' => $userInfo['memRole'],
];
}
}