From 6800332b5b3e0ead728301f6596c41f2e6c586e2 Mon Sep 17 00:00:00 2001 From: ouzhiqiang <835402500@qq.com> Date: Fri, 19 Sep 2025 11:17:49 +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 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/index/controller/TopicNas.php b/app/index/controller/TopicNas.php index 1088e179..a4bedd0b 100644 --- a/app/index/controller/TopicNas.php +++ b/app/index/controller/TopicNas.php @@ -347,7 +347,10 @@ class TopicNas extends Common $parent_two = ArticleCategoryModel::ParentChild(array_column($categorys, 'id'))->language($this->lang_id)->column('pid','id');//二级分类id $articles_data = $articles->toArray(); foreach ($articles_data as &$v) { - $v['pid'] = isset($parent_two[$v['category_id']])?$parent_two[$v['category_id']]:''; + if ( isset($parent_two[$v['category_id']]) ) { + $v['pid'] = $v['category_id']; + $v['category_id'] = $parent_two[$v['category_id']]; + } } return success('success', $articles_data);