浏览代码

搜索结果

kphcdr 1 年之前
父节点
当前提交
397266758e
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      app/Modules/Mini/Services/PageService.php

+ 6 - 1
app/Modules/Mini/Services/PageService.php

@@ -204,7 +204,12 @@ class PageService extends BaseService
             $query->whereIn("id", $goodsIdArr);
 
         })->when($params['keyword'], function (Builder $query) use ($params) {
-            $query->where("name", "like", "%" . $params['keyword'] . "%");
+            $query->where(function (Builder $query) use ($params) {
+                $query->where("name", "like", "%" . $params['keyword'] . "%")
+                    ->orWhere("custom", "like", "%" . $params['keyword'] . "%")
+                    ->orWhere("desc_html", "like", "%" . $params['keyword'] . "%")
+                    ->orWhereIn("id", GoodsSpecMap::where("value", "like", "%{$params['keyword']}%")->get(["goods_id"])->pluck("goods_id")->toArray());
+            });
         })->orderByDesc("weight")->paginate($pageSize);
 
         return [