From 0f4de270516bf9f892d35a22847a2b5fcdcefa1d Mon Sep 17 00:00:00 2001 From: sugar1569 Date: Sat, 24 Nov 2018 11:34:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E7=AB=A0=E5=88=97=E8=A1=A8=E9=A1=B5?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/article/Article.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/application/admin/controller/article/Article.php b/application/admin/controller/article/Article.php index 3c184ee3..f1b9436e 100644 --- a/application/admin/controller/article/Article.php +++ b/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();