From b6cf29edf58eea79638c65201e3cf8b5dfee1fbc Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 15 Nov 2023 15:34:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/store/merchant/Merchant.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/controller/api/store/merchant/Merchant.php b/app/controller/api/store/merchant/Merchant.php index 9ca24a9e..dfe045c1 100644 --- a/app/controller/api/store/merchant/Merchant.php +++ b/app/controller/api/store/merchant/Merchant.php @@ -58,10 +58,20 @@ class Merchant extends BaseController public function lst() { [$page, $limit] = $this->getPage(); - $where = $this->request->params(['keyword', 'order', 'is_best', 'location', 'category_id', 'type_id', 'type_code', 'is_trader', 'street_id', 'credit_buy']); + $where = $this->request->params(['store_category_id','keyword', 'order', 'is_best', 'location', 'category_id', 'type_id', 'type_code', 'is_trader', 'street_id', 'credit_buy']); if (empty($where['type_id'])) { $where['type_id'] =[10,17]; } + if($where['store_category_id']>0){ + $arr= Db::name('store_category')->where(['pid'=>$where['store_category_id'],'mer_id'=>0,'level'=>1,'is_show'=>1])->column('cate_name'); + if($arr){ + $category_id=Db::name('merchant_category')->whereIn('category_name',$arr)->column('merchant_category_id'); + if($category_id){ + $where['category_id']=explode(',',$category_id); + } + } + unset($where['store_category_id']); + } return app('json')->success($this->repository->getList($where, $page, $limit, $this->userInfo)); }