refactor: 修改附件分类列表接口

This commit is contained in:
2025-03-31 14:31:28 +08:00
parent 3bd6577bc9
commit 0b5ae13afd

View File

@@ -18,6 +18,7 @@ class AttachmentCategory
{ {
$params = request()->param([ $params = request()->param([
'name', 'name',
'is_show',
'page/d' => 1, 'page/d' => 1,
'size/d' => 10 'size/d' => 10
]); ]);
@@ -39,7 +40,13 @@ class AttachmentCategory
'page' => $params['page'] 'page' => $params['page']
]); ]);
} else if ('all' == request()->param('scene')) { } else if ('all' == request()->param('scene')) {
$categorys = $categorys->isShow()->select()->hidden(['sort', 'is_show']); $categorys = $categorys->where(function($query) use($params) {
if (isset($params['is_show'])) {
$query->where('is_show', '=', $params['is_show']);
}
})
->select()
->hidden(['sort', 'is_show']);
} }
return success('获取成功', $categorys); return success('获取成功', $categorys);