From 58f8315614a6a4ba74f098d962c6fd6b40a218f4 Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Mon, 4 Sep 2023 11:35:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=BA=97=E9=93=BA=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../merchant/MerchantTypeRepository.php | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/app/common/repositories/system/merchant/MerchantTypeRepository.php b/app/common/repositories/system/merchant/MerchantTypeRepository.php index 00eb9b4e..77a03c77 100644 --- a/app/common/repositories/system/merchant/MerchantTypeRepository.php +++ b/app/common/repositories/system/merchant/MerchantTypeRepository.php @@ -51,16 +51,27 @@ class MerchantTypeRepository extends BaseRepository public function getSelect($getAll = true, $siftStore = false) { - $merTypeIds = $this->userApply ? Merchant::AllowApply : Merchant::AllowDisplay; + // $merTypeIds = $this->userApply ? Merchant::AllowApply : Merchant::AllowDisplay; + $merTypeIds = []; + $queryBuilder = MerchantType::getDB(); + if ($this->userApply) { + $merTypeIds = []; + $queryBuilder = $queryBuilder->where('is_allow_apply', 1); + } else { + $queryBuilder = $queryBuilder->where('is_search_display', 1); + } + // 搜索商家时屏蔽市级供应链 // Merchant::TypeSupplyChain if ($siftStore == true) { - foreach($merTypeIds as $k=>$v) { - if ($v == Merchant::TypeSupplyChain) { - unset($merTypeIds[$k]); - } - } + // foreach($merTypeIds as $k=>$v) { + // if ($v == Merchant::TypeSupplyChain) { + // unset($merTypeIds[$k]); + // } + // } + $queryBuilder = $queryBuilder->where('type_code', '<>', 'TypeSupplyChain'); } + $merTypeIds = $queryBuilder->column('mer_type_id'); $query = MerchantType::getDB()->when(!$getAll, function ($query) use ($merTypeIds) { $query->whereIn('mer_type_id', $merTypeIds); })->field('mer_type_id,type_name');