Kirin 2 years ago
parent
commit
f2556510e0
1 changed files with 4 additions and 1 deletions
  1. 4 1
      application/admin/controller/Category.php

+ 4 - 1
application/admin/controller/Category.php

@@ -32,7 +32,10 @@ class Category extends Backend
         $this->model = model('app\common\model\Category');
 
         $tree = Tree::instance();
-        $tree->init(collection($this->model->where('cid', 'in', [0, $this->auth->getUserInfo()['cid']])->order('weigh desc,id desc')->select())->toArray(), 'pid');
+        if ($this->auth->getUserInfo()['cid'] == 0)
+            $tree->init(collection($this->model->order('weigh desc,id desc')->select())->toArray(), 'pid');
+        else
+            $tree->init(collection($this->model->where('cid', 'in', [0, $this->auth->getUserInfo()['cid']])->order('weigh desc,id desc')->select())->toArray(), 'pid');
         $this->categorylist = $tree->getTreeList($tree->getTreeArray(0), 'name');
         $categorydata = [0 => ['type' => 'all', 'name' => __('None')]];
         foreach ($this->categorylist as $k => $v) {