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']); })