refactor: 修改视频分类列表接口

This commit is contained in:
2025-03-31 14:03:34 +08:00
parent d9127e432e
commit 3a763be41a

View File

@@ -16,7 +16,10 @@ class VideoCategory
*/ */
public function list() public function list()
{ {
$param = request()->param(['name' => '']); $param = request()->param([
'name' => '',
'is_show'
]);
$categorys = VideoCategoryModel::field([ $categorys = VideoCategoryModel::field([
'id', 'id',
'name', 'name',
@@ -25,7 +28,11 @@ class VideoCategory
'name' => $param['name']??null 'name' => $param['name']??null
]) ])
->language(request()->lang_id) ->language(request()->lang_id)
->isShow() ->where(function($query) use($param) {
if (isset($param['is_show'])) {
$query->where('is_show', '=', $param['is_show']);
}
})
->order(['sort' => 'asc', 'id' => 'desc']) ->order(['sort' => 'asc', 'id' => 'desc'])
->select(); ->select();