diff --git a/application/admin/controller/auth/Group.php b/application/admin/controller/auth/Group.php index 1f573b81..f1d12bf4 100644 --- a/application/admin/controller/auth/Group.php +++ b/application/admin/controller/auth/Group.php @@ -254,7 +254,7 @@ class Group extends Backend if (($pid || $parentGroupModel) && (!$id || $currentGroupModel)) { $id = $id ? $id : NULL; - $ruleList = collection(model('AuthRule')->order('weigh', 'desc')->select())->toArray(); + $ruleList = collection(model('AuthRule')->order('weigh', 'desc')->order('id', 'asc')->select())->toArray(); //读取父类角色所有节点列表 $parentRuleList = []; if (in_array('*', explode(',', $parentGroupModel->rules))) diff --git a/application/admin/controller/auth/Rule.php b/application/admin/controller/auth/Rule.php index 897f66ba..b221a90c 100644 --- a/application/admin/controller/auth/Rule.php +++ b/application/admin/controller/auth/Rule.php @@ -27,7 +27,7 @@ class Rule extends Backend parent::_initialize(); $this->model = model('AuthRule'); // 必须将结果集转换为数组 - $ruleList = collection($this->model->order('weigh', 'desc')->select())->toArray(); + $ruleList = collection($this->model->order('weigh', 'desc')->order('id', 'asc')->select())->toArray(); foreach ($ruleList as $k => &$v) { $v['title'] = __($v['title']); @@ -43,6 +43,7 @@ class Rule extends Backend continue; $ruledata[$v['id']] = $v['title']; } + unset($v); $this->view->assign('ruledata', $ruledata); }