From 9e79002c96f23897a22d1cf1d98d8e1403fcc5bd Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Thu, 4 Jan 2024 16:51:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/dao/store/product/SpuDao.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/common/dao/store/product/SpuDao.php b/app/common/dao/store/product/SpuDao.php index 378e4b1c..2470a86b 100644 --- a/app/common/dao/store/product/SpuDao.php +++ b/app/common/dao/store/product/SpuDao.php @@ -47,7 +47,7 @@ class SpuDao extends BaseDao if(isset($where['order']) && $where['order'] === 'none'){ $order = ''; } - $query = Spu::getDB()->alias('S')->join('StoreProduct P','S.product_id = P.product_id', 'left')->where('P.product_type',$where['product_type']); + $query = Spu::getDB()->alias('S')->join('StoreProduct P','S.product_id = P.product_id', 'left'); $query->when(isset($where['is_del']) && $where['is_del'] !== '',function($query)use($where){ $query->where('P.is_del',$where['is_del']); }) @@ -57,6 +57,9 @@ class SpuDao extends BaseDao ->when(isset($where['mer_id']) && $where['mer_id'] !== '',function($query)use($where){ $query->where('P.mer_id',$where['mer_id']); }) + ->when(isset($where['product_type']) && $where['product_type'] !== '',function($query)use($where){ + $query->where('P.product_type',$where['product_type']); + }) ->when(isset($where['mer_array_id']),function($query)use($where){ $query->whereIn('P.mer_id',$where['mer_array_id']); })