diff --git a/app/controller/api/store/product/StoreSpu.php b/app/controller/api/store/product/StoreSpu.php index 7f76d0f5..f8045f69 100644 --- a/app/controller/api/store/product/StoreSpu.php +++ b/app/controller/api/store/product/StoreSpu.php @@ -42,8 +42,6 @@ class StoreSpu extends BaseController public function lst() { [$page, $limit] = $this->getPage(); - // 除了市级供应链都可以查询 - $typeIdArray = Db::name('MerchantType')->whereNotIn('type_code', (string)Merchant::TypeCode['TypeSupplyChain'])->column('mer_type_id'); $where = $this->request->params([ 'keyword', 'cate_id', @@ -59,12 +57,18 @@ class StoreSpu extends BaseController 'common', 'is_trader', 'product_ids', - 'mer_id' + 'mer_id', + 'type_id' ]); + if($where['type_id']){ + $where['mer_ids'] = Merchant::getInstance()->whereIn('type_id', implode(',', $where['type_id']))->where(['status' => 1, 'mer_state' => 1, 'is_del' => 0])->column('mer_id'); + }else{ + unset($where['type_id']); + } $where['is_gift_bag'] = 0; $where['product_type'] = 0; $where['order'] = $where['order'] ?: 'star'; - $where['mer_ids'] = Merchant::getInstance()->whereIn('type_id', implode(',', $typeIdArray ?? []))->where(['status' => 1, 'mer_state' => 1, 'is_del' => 0])->column('mer_id'); + halt($where); if ($where['is_trader'] != 1) unset($where['is_trader']); $data = $this->repository->getApiSearch($where, $page, $limit, $this->userInfo); return app('json')->success($data);