Browse Source

优化规则ruleList排序

pppscn 6 years ago
parent
commit
02029bf972
1 changed files with 2 additions and 1 deletions
  1. 2 1
      application/admin/controller/auth/Rule.php

+ 2 - 1
application/admin/controller/auth/Rule.php

@@ -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);
     }
     }