GetController.class.php
1.47 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
/**
* 获取指定缓存
* User: zhuxun37
* Date: 2017/5/12
* Time: 上午10:32
*/
namespace Apicp\Controller\Setting;
use Common\Common\Cache;
use Common\Common\User;
class GetController extends AbstractController
{
// 管理权限查询key
const MANAGE_AUTHS_KEY = "manageAuths";
public function Index_post()
{
$key = (string)I('post.key');
if (empty($key)) {
E('_ERR_PARAM_IS_NULL');
return false;
}
$settings = Cache::instance()->get('Common.AppSetting');
if (empty($settings[$key])) {
E('_ERR_PARAM_IS_NULL');
return false;
}
// 是获取管理权限配置
if (self::MANAGE_AUTHS_KEY == $key) {
// 有管理权限的用户
$manageAuths = $settings[$key]['value'];
$hadSetting = !empty($manageAuths);
// 有配置管理用户, 过滤掉不存在的管理用户
if ($hadSetting) {
list($existAuthIds, $existAuthInfoList) = $this->filterNonExistAuthTarget($manageAuths['selectedList']);
$manageAuths['selectedList'] = $existAuthInfoList;
$manageAuths['auths'] = $existAuthIds;
$this->_result = $manageAuths;
} else {
$this->_result = [];
}
} else {
$this->_result = empty($settings[$key]['value']) ? [] : $settings[$key]['value'];
}
return true;
}
}