Ver Fonte

搜索结果

kphcdr há 1 ano atrás
pai
commit
397266758e
1 ficheiros alterados com 6 adições e 1 exclusões
  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 [