refactor: 修改附件及视频分类查询
This commit is contained in:
@@ -53,6 +53,9 @@ class Attachment extends Common
|
|||||||
->paginate([
|
->paginate([
|
||||||
'list_rows' => $param['size'],
|
'list_rows' => $param['size'],
|
||||||
'page' => $param['page'],
|
'page' => $param['page'],
|
||||||
|
'query' => [
|
||||||
|
'id' => $param['id']??null
|
||||||
|
]
|
||||||
]);
|
]);
|
||||||
View::assign('attachements', $attachements);
|
View::assign('attachements', $attachements);
|
||||||
View::assign('page', $attachements->render());
|
View::assign('page', $attachements->render());
|
||||||
@@ -66,6 +69,7 @@ class Attachment extends Common
|
|||||||
public function video()
|
public function video()
|
||||||
{
|
{
|
||||||
$param = request()->param([
|
$param = request()->param([
|
||||||
|
'id',
|
||||||
'page/d' => 1,
|
'page/d' => 1,
|
||||||
'size/d' => 12
|
'size/d' => 12
|
||||||
]);
|
]);
|
||||||
@@ -103,10 +107,14 @@ class Attachment extends Common
|
|||||||
'link'
|
'link'
|
||||||
])
|
])
|
||||||
->language($this->lang_id)
|
->language($this->lang_id)
|
||||||
|
->category($param['id']??null)
|
||||||
->order(['sort' => 'asc', 'id' => 'desc'])
|
->order(['sort' => 'asc', 'id' => 'desc'])
|
||||||
->paginate([
|
->paginate([
|
||||||
'list_rows' => $param['size'],
|
'list_rows' => $param['size'],
|
||||||
'page' => $param['page'],
|
'page' => $param['page'],
|
||||||
|
'query' => [
|
||||||
|
'id' => $param['id']??null
|
||||||
|
]
|
||||||
]);
|
]);
|
||||||
View::assign('videos', $videos);
|
View::assign('videos', $videos);
|
||||||
View::assign('page', $videos->render());
|
View::assign('page', $videos->render());
|
||||||
|
|||||||
@@ -29,4 +29,13 @@ class VideoModel extends VideoBaseModel
|
|||||||
{
|
{
|
||||||
$query->where('recommend', '=', (int)$recommend);
|
$query->where('recommend', '=', (int)$recommend);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 所属分类范围查询
|
||||||
|
public function scopeCategory($query, $category)
|
||||||
|
{
|
||||||
|
if (is_null($category)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$query->where('category_id', '=', $category);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user