diff --git a/app/common/model/Goods.php b/app/common/model/Goods.php index eacb0f00..5678c382 100644 --- a/app/common/model/Goods.php +++ b/app/common/model/Goods.php @@ -313,7 +313,7 @@ class Goods extends BaseModel 'goodsName' => null, // 商品名称 'goodsNo' => null, // 商品编码 'status' => 0, // 商品状态(0全部 10上架 20下架) - 'keywords' => [] + 'keywords' => '' ]); // 实例化新查询对象 @@ -346,10 +346,8 @@ class Goods extends BaseModel } // 商品名称 - if (is_array($params['keywords'])) { - foreach ($params['keywords'] as $val) { - $filter[] = ['goods_name', 'like', "%{$val}%"]; - } + foreach (explode(",", $params['keywords']?? '') as $val) { + $filter[] = ['goods_name', 'like', "%{$val}%"]; } // 商品名称