AttributeInfoController.class.php
1.62 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
<?php
/**
* Created by PhpStorm.
* User: liyifei2012it
* Date: 16/9/17
* Time: 22:37
*/
namespace Apicp\Controller\User;
use Common\Model\AttrModel;
use Common\Service\AttrService;
use Common\Service\JobService;
use Common\Service\RoleService;
class AttributeInfoController extends AbstractController
{
/**
* 【通讯录】人员属性详情
* @author liyifei
* @time 2016-09-17 22:38:54
*/
public function Index_post()
{
$attrService = new AttrService();
$data = $attrService->getAttrList(true, array(), true);
if (empty($data)) {
E('_ERR_ATTR_IS_EMPTY');
}
$list = [];
$isCustom = AttrService::ATTR_CUSTOM_IS_FALSE;
foreach ($data as $k => $v) {
// 是否存在自定义属性(方便前端布局)
if ($v['postion'] == AttrModel::AREA_CUSTOM) {
$isCustom = AttrService::ATTR_CUSTOM_IS_TRUE;
} else {
$isCustom = AttrService::ATTR_CUSTOM_IS_FALSE;
}
$list[$k]['field_name'] = $v['field_name'];
$list[$k]['attr_name'] = $v['attr_name'];
$list[$k]['is_system'] = $v['is_system'];
$list[$k]['is_required'] = $v['is_required'];
$list[$k]['is_required_cp'] = $v['is_required_cp'];
$list[$k]['order'] = $v['order'];
$list[$k]['postion'] = $v['postion'];
$list[$k]['type'] = $v['type'];
$list[$k]['option'] = $v['option'];
}
$this->_result = [
'is_custom' => $isCustom,
'list' => array_values($list)
];
}
}