refactor: 修改文章及文章分类列表接口
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user