fix: pc 产品,附件,视频搜索去除首尾空格

This commit is contained in:
2025-07-21 17:31:17 +08:00
parent 1cfae69a27
commit 865fe2fc44
2 changed files with 3 additions and 3 deletions

View File

@@ -50,7 +50,7 @@ class Attachment extends Common
'support_platform', 'support_platform',
'attach', 'attach',
]) ])
->withSearch(['name'], ['name' => !empty($param['keyword']) ? $param['keyword'] : null]) ->withSearch(['name'], ['name' => !empty($param['keyword']) ? trim($param['keyword']) : null])
->language($this->lang_id) ->language($this->lang_id)
->category(!empty($param['id']) ? $param['id'] : $categorys[0]['id']??null) ->category(!empty($param['id']) ? $param['id'] : $categorys[0]['id']??null)
->order(['sort' => 'asc', 'id' => 'desc']) ->order(['sort' => 'asc', 'id' => 'desc'])
@@ -111,7 +111,7 @@ class Attachment extends Common
'video', 'video',
'link' 'link'
]) ])
->withSearch(['name'], ['name' => !empty($param['keyword']) ? $param['keyword'] : null]) ->withSearch(['name'], ['name' => !empty($param['keyword']) ? trim($param['keyword']) : null])
->language($this->lang_id) ->language($this->lang_id)
->category(!empty($param['id']) ? $param['id'] : $video_categorys[0]['id']??null) ->category(!empty($param['id']) ? $param['id'] : $video_categorys[0]['id']??null)
->order(['sort' => 'asc', 'id' => 'desc']) ->order(['sort' => 'asc', 'id' => 'desc'])

View File

@@ -277,7 +277,7 @@ class Product extends Common
'page/d' => 1, 'page/d' => 1,
'size/d' => 10 'size/d' => 10
]); ]);
$keywords = $param['keywords'] ?? ''; $keywords = !empty($param['keywords']) ? trim($param['keywords']) : '';
// 关键词搜索 // 关键词搜索
$products = ProductModel::field([ $products = ProductModel::field([