优化小组采购商品获取

This commit is contained in:
monanxiao 2023-03-17 11:31:05 +08:00
parent 47f53e660e
commit 0afc6f5b87
2 changed files with 7 additions and 2 deletions

View File

@ -140,6 +140,12 @@ class SpuRepository extends BaseRepository
$where['spu_status'] = 1; $where['spu_status'] = 1;
$where['mer_status'] = 1; $where['mer_status'] = 1;
if($source == 1)
{
//获取自提
$where['delivery_way'] = 1;
}
$query = $this->dao->search($where); $query = $this->dao->search($where);
$query->with([ $query->with([
@ -160,8 +166,6 @@ class SpuRepository extends BaseRepository
// 只获取当前供应链内商户的商品 // 只获取当前供应链内商户的商品
$query->whereIn('S.mer_id', $MerListId); $query->whereIn('S.mer_id', $MerListId);
//获取自提
$query->whereLike('delivery_way',"%1%");
} }
$productMake = app()->make(ProductRepository::class); $productMake = app()->make(ProductRepository::class);

View File

@ -65,6 +65,7 @@ class StoreSpu extends BaseController
$where['product_type'] = 0; $where['product_type'] = 0;
$where['order'] = $where['order'] ?: 'star'; $where['order'] = $where['order'] ?: 'star';
$source = $this->request->param('source'); // 1 小组服务 2 普通来源 $source = $this->request->param('source'); // 1 小组服务 2 普通来源
$source = !isset($source)?2:$source; // 默认来源为2 普通商品订单
if ($where['is_trader'] != 1) unset($where['is_trader']); if ($where['is_trader'] != 1) unset($where['is_trader']);
$data = $this->repository->getApiSearch($where, $page, $limit, $this->userInfo, $source); $data = $this->repository->getApiSearch($where, $page, $limit, $this->userInfo, $source);
return app('json')->success($data); return app('json')->success($data);