refactor: 修改文章及文章分类列表接口

This commit is contained in:
2025-01-13 17:07:27 +08:00
parent 4aebf5edf2
commit 7cdfa007c6
2 changed files with 26 additions and 13 deletions

View File

@@ -12,7 +12,7 @@ class ArticleCategory
public function index()
{
$param = request()->param([
'name' => '',
'name',
'page/d' => 1,
'limit/d' => 10,
]);
@@ -24,10 +24,16 @@ class ArticleCategory
'seo_keywords',
'seo_desc',
])
->withSearch(['name'], ['name' => $param['name']])
->where(function($query) use($param) {
if (isset($param['name'])) {
$query->withSearch(['name'], ['name' => $param['name']]);
}
})
->order('sort', 'asc')
->page($param['page'], $param['limit'])
->select();
->paginate([
'page' => $param['page'],
'list_rows' => $param['limit']
]);
return success('获取成功', $category);
}