更新店铺类型

This commit is contained in:
yaooo 2023-09-04 11:35:54 +08:00
parent 9599c910e8
commit 58f8315614

View File

@ -51,16 +51,27 @@ class MerchantTypeRepository extends BaseRepository
public function getSelect($getAll = true, $siftStore = false) 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 // Merchant::TypeSupplyChain
if ($siftStore == true) { if ($siftStore == true) {
foreach($merTypeIds as $k=>$v) { // foreach($merTypeIds as $k=>$v) {
if ($v == Merchant::TypeSupplyChain) { // if ($v == Merchant::TypeSupplyChain) {
unset($merTypeIds[$k]); // 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 = MerchantType::getDB()->when(!$getAll, function ($query) use ($merTypeIds) {
$query->whereIn('mer_type_id', $merTypeIds); $query->whereIn('mer_type_id', $merTypeIds);
})->field('mer_type_id,type_name'); })->field('mer_type_id,type_name');