From e301fc7e94d563812dfc0b147acc4b101c40d24d Mon Sep 17 00:00:00 2001 From: ouzhiqiang <835402500@qq.com> Date: Fri, 19 Sep 2025 14:47:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/index/controller/TopicNas.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/index/controller/TopicNas.php b/app/index/controller/TopicNas.php index e41128a6..3051c7f1 100644 --- a/app/index/controller/TopicNas.php +++ b/app/index/controller/TopicNas.php @@ -213,11 +213,10 @@ class TopicNas extends Common //查询三级分类 $article_categorys_new = []; $article_categorys_two = []; - dump($article_categorys->toArray());exit; +// 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; @@ -225,13 +224,21 @@ class TopicNas extends Common } if ( !empty($article_categorys_two) ) { foreach ($article_categorys_new as &$vvv) { - $vvv['child'] = isset($article_categorys_two[$vvv['id']])?$article_categorys_two[$vvv['id']]:''; + $articles = $vvv['article']; + if ( isset($article_categorys_two[$vvv['id']]) ) { + foreach ($article_categorys_two[$vvv['id']] as $k=>$v) { + $articles = array_merge($articles,$v['article']); + } + + } + $vvv['article'] = $articles; } } } - View::assign('article_categorys', $article_categorys); + View::assign('article_categorys', $article_categorys_new); +// View::assign('article_categorys', $article_categorys); $contacts = []; // 获取banner数据