Explorar el Código

文章列表页报错

sugar1569 hace 7 años
padre
commit
0f4de27051
Se han modificado 1 ficheros con 11 adiciones y 5 borrados
  1. 11 5
      application/admin/controller/article/Article.php

+ 11 - 5
application/admin/controller/article/Article.php

@@ -34,13 +34,19 @@ class Article extends AuthController
         $where['merchant'] = 0;//区分是管理员添加的图文显示  0 还是 商户添加的图文显示  1
         $catlist = ArticleCategoryModel::where('is_del',0)->select()->toArray();
         //获取分类列表
-        $tree = Phptree::makeTreeForHtml($catlist);
-        $this->assign(compact('tree'));
-        if($pid){
-            $pids = Util::getChildrenPid($tree,$pid);
-            $where['cid'] = ltrim($pid.$pids);
+        if($catlist){
+            $tree = Phptree::makeTreeForHtml($catlist);
+            $this->assign(compact('tree'));
+            if($pid){
+                $pids = Util::getChildrenPid($tree,$pid);
+                $where['cid'] = ltrim($pid.$pids);
+            }
+        }else{
+            $tree = [];
+            $this->assign(compact('tree'));
         }
 
+
         $this->assign('cate',ArticleCategoryModel::getTierList());
         $this->assign(ArticleModel::getAll($where));
         return $this->fetch();