修改分类

This commit is contained in:
ouzhiqiang
2025-09-18 15:25:29 +08:00
parent f6e37d33f8
commit 2e62fee31a
2 changed files with 29 additions and 1 deletions

View File

@@ -246,19 +246,36 @@ class TopicNas extends Common
// 获取文章分类及文章数据
$parent = ArticleCategoryModel::uniqueLabel('CATEGORY_681182e0a4529')->language($this->lang_id)->value('id');
$parent_two = ArticleCategoryModel::parent($parent)->language($this->lang_id)->column('id');//二级分类id
array_push($parent_two,$parent);
$article_categorys = ArticleCategoryModel::with(['article' => function ($query) {
$query->field(['id', 'title', 'category_id'])->order(['sort' => 'asc', 'id' => 'desc']);
}])
->field([
'id',
'pid',
'name',
'icon'
])
->language($this->lang_id)
->parent($parent)
// ->parent($parent)
->parentChild($parent_two)
->isShow(true)
->order(['sort' => 'asc', 'id' => 'desc'])
->select();
dump($article_categorys);exit;
//查询三级分类
$article_categorys_new = [];
if (!$article_categorys->isEmpty()) {
foreach ($article_categorys as $kk=>$vv) {
$article_categorys_two = [];
if ( $parent == $vv->pid ) {
}
}
}
View::assign('article_categorys', $article_categorys);
return View::fetch('help_detail');