diff --git a/app/common/model/Goods.php b/app/common/model/Goods.php index 4664e8c7..ab33f43c 100644 --- a/app/common/model/Goods.php +++ b/app/common/model/Goods.php @@ -194,7 +194,7 @@ class Goods extends BaseModel $this->getPk() => 'desc', ]; } - + $field = $this->getAliasFields($this->name, ['content']); @@ -311,6 +311,7 @@ class Goods extends BaseModel 'goodsName' => null, // 商品名称 'goodsNo' => null, // 商品编码 'status' => 0, // 商品状态(0全部 10上架 20下架) + 'keywords' => [] ]); // 实例化新查询对象 @@ -342,6 +343,9 @@ class Goods extends BaseModel $a = 1; } + if(count($params['keywords']) > 0 ) { + $filter[] = ['goods_name', 'like', "%{$params['keywords']}%"]; + } // 商品名称 !empty($params['goodsName']) && $filter[] = ['goods_name', 'like', "%{$params['goodsName']}%"]; // 商品编码 @@ -366,7 +370,7 @@ class Goods extends BaseModel if (isset($param['is_in_store']) && $param['is_in_store'] !== '') { $filter[] = ['is_in_store', '=', $params['is_in_store']]; } - + if (isset($param['store_id']) && $param['store_id'] !== '') { $filter[] = ['goods.store_id', '=', $params['store_id']]; } @@ -391,7 +395,7 @@ class Goods extends BaseModel // 遍历商品列表整理数据 foreach ($list as &$goods) { - + $goods = $this->setGoodsData($goods, $callback); }