diff --git a/app/common/dao/store/product/ProductDao.php b/app/common/dao/store/product/ProductDao.php index 45a3a944..7d4b2fbf 100644 --- a/app/common/dao/store/product/ProductDao.php +++ b/app/common/dao/store/product/ProductDao.php @@ -151,6 +151,9 @@ class ProductDao extends BaseDao }); } }) + ->when(isset($where['keyword']) && $where['keyword'] !== '', function ($query) use ($where) { + $query->whereLike('Product.keyword', "%{$where['keyword']}%"); + }) ->when(isset($where['mer_labels']) && $where['mer_labels'] !== '', function ($query) use ($where) { $query->whereLike('U.mer_labels', "%,{$where['mer_labels']},%"); }) diff --git a/app/common/repositories/store/product/ProductRepository.php b/app/common/repositories/store/product/ProductRepository.php index 2ec4d5cb..8dc950aa 100644 --- a/app/common/repositories/store/product/ProductRepository.php +++ b/app/common/repositories/store/product/ProductRepository.php @@ -2447,6 +2447,9 @@ class ProductRepository extends BaseRepository unset($where['uid']); $where['status'] = 1; $where['is_show'] = 1; + if (!empty($keyword)) { + $where['keyword'] = $keyword; + } $query = $this->dao->search($merId, $where)->with(['merCateId.category', 'storeCategory', 'brand', 'attrValue']); $count = $query->count(); $data = $query->page($page, $limit)->setOption('field', [])->field($this->filed)->select();