refactor: 修改后台文章分类相关接口

This commit is contained in:
2025-04-10 17:47:15 +08:00
parent 4f411d9e77
commit f2f58b85dc

View File

@@ -32,7 +32,10 @@ class ArticleCategory
})
->order('sort', 'asc')
->select();
return success('获取成功', array_to_tree($categorys, 0, 'pid', 1, false));
if (!$categorys->isEmpty()) {
$categorys = array_to_tree($categorys, 0, 'pid', 1, false);
}
return success('获取成功', $categorys);
}
// 分类分页列表
@@ -54,8 +57,11 @@ class ArticleCategory
})
->order('sort', 'asc')
->select();
if (!$category->isEmpty()) {
$category = array_to_tree($category, 0, 'pid', 1, false);
}
return success('获取成功', array_to_tree($category, 0, 'pid', 1, false));
return success('获取成功', $category);
}
// 分类详情