fix: pc 视频搜索

This commit is contained in:
2025-07-21 16:54:43 +08:00
parent 3dc78437ee
commit b917234f9a
3 changed files with 11 additions and 9 deletions

View File

@@ -21,11 +21,13 @@ class Attachment extends Common
{
$param = request()->param([
'id',
'keyword',
'page/d' => 1,
'size/d' => 12,
'keyword' => '',
'page/d' => 1,
'size/d' => 12,
]);
// 获取附件分类
$categorys = AttachmentCategoryModel::field([
'id',
@@ -48,9 +50,9 @@ class Attachment extends Common
'support_platform',
'attach',
])
->withSearch(['name'], ['name' => $param['keyword']??null])
->withSearch(['name'], ['name' => !empty($param['keyword']) ? $param['keyword'] : null])
->language($this->lang_id)
->category($param['id']??null)
->category(!empty($param['id']) ? $param['id'] : $categorys[0]['id']??null)
->order(['sort' => 'asc', 'id' => 'desc'])
->paginate([
'list_rows' => $param['size'],
@@ -109,9 +111,9 @@ class Attachment extends Common
'video',
'link'
])
->withSearch(['name'], ['name' => $param['keyword']??null])
->withSearch(['name'], ['name' => !empty($param['keyword']) ? $param['keyword'] : null])
->language($this->lang_id)
->category($param['id']??$video_categorys[0]['id']??null)
->category(!empty($param['id']) ? $param['id'] : $video_categorys[0]['id']??null)
->order(['sort' => 'asc', 'id' => 'desc'])
->paginate([
'list_rows' => $param['size'],

View File

@@ -14,7 +14,7 @@
<!-- 搜索 -->
<form action="{:url('attachment/index')}" method="get">
<div class="search_all">
<input type="hidden" name="id" value="{$Request.get.id}" />
<input type="hidden" name="id" value="{$Request.get.id??$categorys[0]['id']??''}" />
<input type="text" name="keyword" placeholder="{:lang_i18n('搜索')}" />
<button class="searchbtn" type="submit"><img src="__IMAGES__/search_blue.png" /></button>
</div>

View File

@@ -14,7 +14,7 @@
<!-- 搜索 -->
<form action="{:url('attachment/video')}" method="get">
<div class="search_all">
<input type="hidden" name="id" value="{$Request.get.id}" />
<input type="hidden" name="id" value="{$Request.get.id??$video_categorys[0]['id']??''}" />
<input type="text" name="keyword" placeholder="{:lang_i18n('搜索')}" />
<button class="searchbtn" type="submit"><img src="__IMAGES__/search_blue.png" /></button>
</div>