From 3ba69a2b6f8a8e44a7101f159668f399f9a8b0fe Mon Sep 17 00:00:00 2001 From: "zhangf@suq.cn" Date: Mon, 7 Sep 2026 14:13:58 +0800 Subject: [PATCH] =?UTF-8?q?feat(search):=20=E6=B7=BB=E5=8A=A0=E5=B0=81?= =?UTF-8?q?=E9=9D=A2=E5=85=B3=E8=81=94=E6=9F=A5=E8=AF=A2=E4=BB=A5=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E6=90=9C=E7=B4=A2=E7=BB=93=E6=9E=9C=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 SubContent 查询中新增 cover 关联关系 - 为 cover 关联配置字段筛选 (id, name, url, type) - 保持原有的 thumbnail 和 category 关联查询逻辑 - 优化搜索结果中媒体资源的加载效率 --- app/controller/frontend/SearchController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controller/frontend/SearchController.php b/app/controller/frontend/SearchController.php index 666322f..4f50b90 100644 --- a/app/controller/frontend/SearchController.php +++ b/app/controller/frontend/SearchController.php @@ -226,7 +226,9 @@ class SearchController extends BaseController $baseWhere = ['seller_id' => $this->sellerId, 'is_del' => 1]; $content = (new SubContent())->with(['thumbnail'=>function($q){ $q->field('id,name,url,type'); - },'category'])->where($baseWhere)->whereIn('id', $listSubIds ?: [0]); + },'category', 'cover'=>function($q){ + $q->field('id,name,url,type'); + }])->where($baseWhere)->whereIn('id', $listSubIds ?: [0]); $productIdSet = array_flip($productContentIds); $newsIdSet = array_flip($newsContentIds);