浏览代码

优化规则ruleList排序

pppscn 6 年之前
父节点
当前提交
02029bf972
共有 1 个文件被更改,包括 2 次插入1 次删除
  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();
         $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);
     }