From b3565d0a762f3713b312d301a1a5cfa36f6a69e0 Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Mon, 21 Aug 2023 14:49:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=9F=A5=E8=AF=A2=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/dao/store/product/ProductDao.php | 3 +++ app/common/repositories/store/product/ProductRepository.php | 3 +++ 2 files changed, 6 insertions(+) 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();