added 代码备份

This commit is contained in:
zhaoxiang 2018-02-09 01:10:44 +08:00
parent b34d8e6723
commit 0924b0cdfc
3 changed files with 29 additions and 1 deletions

View File

@ -9,6 +9,8 @@ namespace app\admin\controller;
use app\model\ApiAuthGroup;
use app\model\ApiAuthRule;
use app\model\ApiMenu;
use app\model\ApiUser;
use app\util\ReturnCode;
@ -40,6 +42,28 @@ class Auth extends Base {
]);
}
public function getRuleList() {
$groupId = $this->request->get('groupId', 0);
$list = (new ApiMenu)->where([])->order('sort', 'ASC')->select();
$list = $this->buildArrFromObj($list);
$list = listToTree($list);
if ($groupId) {
$rules = (new ApiAuthRule())->where(['groupId' => $groupId])->select();
$rules = array_column($rules, 'url');
}
$newList = [];
foreach ($list as $key => $value) {
}
return $this->buildSuccess([
'list' => $newList
], '登录成功');
}
/**
* 新增用户 等待组权限
* @return array

View File

@ -21,7 +21,7 @@ class Menu extends Base {
*/
public function index() {
$list = ApiMenu::all();
$list = json_decode(json_encode($list), true);
$list = $this->buildArrFromObj($list);
$list = formatTree(listToTree($list));
return $this->buildSuccess([

View File

@ -71,6 +71,10 @@ return [
'admin/Auth/del',
['method' => 'get', 'after_behavior' => $afterBehavior]
],
'Auth/getRuleList' => [
'admin/Auth/getRuleList',
['method' => 'get', 'after_behavior' => $afterBehavior]
],
'__miss__' => ['admin/Miss/index'],
],
];