diff --git a/app/index/controller/Attachment.php b/app/index/controller/Attachment.php index 725738c1..fc267249 100644 --- a/app/index/controller/Attachment.php +++ b/app/index/controller/Attachment.php @@ -50,7 +50,7 @@ class Attachment extends Common 'support_platform', 'attach', ]) - ->withSearch(['name'], ['name' => !empty($param['keyword']) ? $param['keyword'] : null]) + ->withSearch(['name'], ['name' => !empty($param['keyword']) ? trim($param['keyword']) : null]) ->language($this->lang_id) ->category(!empty($param['id']) ? $param['id'] : $categorys[0]['id']??null) ->order(['sort' => 'asc', 'id' => 'desc']) @@ -111,7 +111,7 @@ class Attachment extends Common 'video', 'link' ]) - ->withSearch(['name'], ['name' => !empty($param['keyword']) ? $param['keyword'] : null]) + ->withSearch(['name'], ['name' => !empty($param['keyword']) ? trim($param['keyword']) : null]) ->language($this->lang_id) ->category(!empty($param['id']) ? $param['id'] : $video_categorys[0]['id']??null) ->order(['sort' => 'asc', 'id' => 'desc']) diff --git a/app/index/controller/Product.php b/app/index/controller/Product.php index 92610575..fd93d7c3 100644 --- a/app/index/controller/Product.php +++ b/app/index/controller/Product.php @@ -277,7 +277,7 @@ class Product extends Common 'page/d' => 1, 'size/d' => 10 ]); - $keywords = $param['keywords'] ?? ''; + $keywords = !empty($param['keywords']) ? trim($param['keywords']) : ''; // 关键词搜索 $products = ProductModel::field([