From 1d74ee626576c41269145bbf1939c0ab27359e2e Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 8 Nov 2023 15:11:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/store/product/StoreSpu.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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);