refactor: 视频分页接口添加视频分类返回
This commit is contained in:
@@ -37,7 +37,7 @@ class Video
|
|||||||
'created_at'
|
'created_at'
|
||||||
])
|
])
|
||||||
->with(['category' => function ($query) {
|
->with(['category' => function ($query) {
|
||||||
$query->field(['id', 'name']);
|
$query->field(['id', 'name' => 'category_name']);
|
||||||
}])
|
}])
|
||||||
->withSearch(['name', 'created_at'], [
|
->withSearch(['name', 'created_at'], [
|
||||||
'name' => $params['name'] ?? null,
|
'name' => $params['name'] ?? null,
|
||||||
@@ -50,6 +50,7 @@ class Video
|
|||||||
'list_rows' => $params['size'],
|
'list_rows' => $params['size'],
|
||||||
'page' => $params['page'],
|
'page' => $params['page'],
|
||||||
])
|
])
|
||||||
|
->bindAttr('category', ['category_name'])
|
||||||
->hidden(['category', 'category_id']);
|
->hidden(['category', 'category_id']);
|
||||||
|
|
||||||
return success('获取成功', $videos);
|
return success('获取成功', $videos);
|
||||||
|
|||||||
Reference in New Issue
Block a user