修改分类

This commit is contained in:
ouzhiqiang
2025-09-19 11:09:29 +08:00
parent c54441c60f
commit 49a849f92c
2 changed files with 8 additions and 2 deletions

View File

@@ -343,8 +343,14 @@ class TopicNas extends Common
->language($this->lang_id) ->language($this->lang_id)
->where('category_id', 'IN', array_column($categorys, 'id')) ->where('category_id', 'IN', array_column($categorys, 'id'))
->select(); ->select();
//查询上级id
$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']]:'';
}
return success('success', $articles->toArray()); return success('success', $articles_data);
} }
/** /**

View File

@@ -135,7 +135,7 @@
html = '<ul>' html = '<ul>'
$.each(r.data, function (k, v) { $.each(r.data, function (k, v) {
html += html +=
'<li><a href="{:url(\'/index/topic/nas/help_detail\')}?cid=' + v.category_id + '&id=' + v.id + '">' + v.title + '</a></li>' '<li><a href="{:url(\'/index/topic/nas/help_detail\')}?cid=' + v.category_id + '&id=' + v.id + '&pid=' + v.pid + '">' + v.title + '</a></li>'
}) })
html += '</ul>' html += '</ul>'
} }