diff --git a/app/common/repositories/store/product/SpuRepository.php b/app/common/repositories/store/product/SpuRepository.php index 85c6e57b..c500bbb6 100644 --- a/app/common/repositories/store/product/SpuRepository.php +++ b/app/common/repositories/store/product/SpuRepository.php @@ -140,6 +140,12 @@ class SpuRepository extends BaseRepository $where['spu_status'] = 1; $where['mer_status'] = 1; + if($source == 1) + { + //获取自提 + $where['delivery_way'] = 1; + } + $query = $this->dao->search($where); $query->with([ @@ -160,8 +166,6 @@ class SpuRepository extends BaseRepository // 只获取当前供应链内商户的商品 $query->whereIn('S.mer_id', $MerListId); - //获取自提 - $query->whereLike('delivery_way',"%1%"); } $productMake = app()->make(ProductRepository::class); diff --git a/app/controller/api/store/product/StoreSpu.php b/app/controller/api/store/product/StoreSpu.php index 22bc1a6c..ceedf976 100644 --- a/app/controller/api/store/product/StoreSpu.php +++ b/app/controller/api/store/product/StoreSpu.php @@ -65,6 +65,7 @@ class StoreSpu extends BaseController $where['product_type'] = 0; $where['order'] = $where['order'] ?: 'star'; $source = $this->request->param('source'); // 1 小组服务 2 普通来源 + $source = !isset($source)?2:$source; // 默认来源为2 普通商品订单 if ($where['is_trader'] != 1) unset($where['is_trader']); $data = $this->repository->getApiSearch($where, $page, $limit, $this->userInfo, $source); return app('json')->success($data);