From 1cfae69a2730ab818ad9f19d3321b06ecff1c2e0 Mon Sep 17 00:00:00 2001 From: jsasg <735273025@qq.com> Date: Mon, 21 Jul 2025 16:54:43 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20pc=20=E8=A7=86=E9=A2=91=E6=90=9C?= =?UTF-8?q?=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/index/controller/Attachment.php | 16 +++++++++------- app/index/view/pc/attachment/index.html | 2 +- app/index/view/pc/attachment/video.html | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/app/index/controller/Attachment.php b/app/index/controller/Attachment.php index 5fe82545..725738c1 100644 --- a/app/index/controller/Attachment.php +++ b/app/index/controller/Attachment.php @@ -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'], diff --git a/app/index/view/pc/attachment/index.html b/app/index/view/pc/attachment/index.html index 6421d450..62a62834 100644 --- a/app/index/view/pc/attachment/index.html +++ b/app/index/view/pc/attachment/index.html @@ -14,7 +14,7 @@
- +
diff --git a/app/index/view/pc/attachment/video.html b/app/index/view/pc/attachment/video.html index c0d256cd..ff5665ab 100644 --- a/app/index/view/pc/attachment/video.html +++ b/app/index/view/pc/attachment/video.html @@ -14,7 +14,7 @@
- +
From 865fe2fc44f512dbb60914f970b43a6981ac9550 Mon Sep 17 00:00:00 2001 From: jsasg <735273025@qq.com> Date: Mon, 21 Jul 2025 17:31:17 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20pc=20=E4=BA=A7=E5=93=81=EF=BC=8C?= =?UTF-8?q?=E9=99=84=E4=BB=B6=EF=BC=8C=E8=A7=86=E9=A2=91=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E5=8E=BB=E9=99=A4=E9=A6=96=E5=B0=BE=E7=A9=BA=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/index/controller/Attachment.php | 4 ++-- app/index/controller/Product.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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([