diff --git a/app/index/controller/TopicNas.php b/app/index/controller/TopicNas.php index e565cebd..e41128a6 100644 --- a/app/index/controller/TopicNas.php +++ b/app/index/controller/TopicNas.php @@ -210,6 +210,27 @@ class TopicNas extends Common ->isShow(true) ->order(['sort' => 'asc', 'id' => 'desc']) ->select(); + //查询三级分类 + $article_categorys_new = []; + $article_categorys_two = []; + dump($article_categorys->toArray());exit; + if (!$article_categorys->isEmpty()) { + foreach ($article_categorys->toArray() as $kk=>$vv) { + if ( $parent == $vv['pid'] ) { + $vv['child'] = ''; + array_push($article_categorys_new,$vv); + } else { + $article_categorys_two[$vv['pid']][] = $vv; + } + } + if ( !empty($article_categorys_two) ) { + foreach ($article_categorys_new as &$vvv) { + $vvv['child'] = isset($article_categorys_two[$vvv['id']])?$article_categorys_two[$vvv['id']]:''; + } + } + } + + View::assign('article_categorys', $article_categorys); $contacts = [];