修改分类

This commit is contained in:
ouzhiqiang
2025-09-18 17:04:29 +08:00
parent 36de45c2e8
commit 810b581d87

View File

@@ -268,20 +268,20 @@ class TopicNas extends Common
$article_categorys_new = []; $article_categorys_new = [];
$article_categorys_two = []; $article_categorys_two = [];
if (!$article_categorys->isEmpty()) { if (!$article_categorys->isEmpty()) {
foreach ($article_categorys as $kk=>$vv) { foreach ($article_categorys->toArray() as $kk=>$vv) {
if ( $parent == $vv->pid ) { if ( $parent == $vv['pid'] ) {
array_push($article_categorys_new,$vv); array_push($article_categorys_new,$vv);
} else { } else {
$article_categorys_two[$vv->pid][] = $vv; $article_categorys_two[$vv['pid']][] = $vv;
} }
} }
if ( !empty($article_categorys_two) ) { if ( !empty($article_categorys_two) ) {
foreach ($article_categorys_new as &$vvv) { foreach ($article_categorys_new as &$vvv) {
$vvv['child'] = isset($article_categorys_two[$vvv->id])?$article_categorys_two[$vvv->id]:''; $vvv['child'] = isset($article_categorys_two[$vvv['id']])?$article_categorys_two[$vvv['id']]:'';
} }
} }
} }
dump($article_categorys_new->toArray());exit; dump($article_categorys_new);exit;
// dump($article_categorys_two);exit; // dump($article_categorys_two);exit;
View::assign('article_categorys', $article_categorys_new); View::assign('article_categorys', $article_categorys_new);