优化规则ruleList排序

pull/98/MERGE
pppscn 2019-02-16 14:41:53 +08:00 committed by Karson
parent ac312ef41e
commit 02029bf972
1 changed files with 2 additions and 1 deletions

View File

@ -27,7 +27,7 @@ class Rule extends Backend
parent::_initialize(); parent::_initialize();
$this->model = model('AuthRule'); $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) foreach ($ruleList as $k => &$v)
{ {
$v['title'] = __($v['title']); $v['title'] = __($v['title']);
@ -43,6 +43,7 @@ class Rule extends Backend
continue; continue;
$ruledata[$v['id']] = $v['title']; $ruledata[$v['id']] = $v['title'];
} }
unset($v);
$this->view->assign('ruledata', $ruledata); $this->view->assign('ruledata', $ruledata);
} }