更新店铺筛选条件

This commit is contained in:
yaooo 2023-08-25 15:18:19 +08:00
parent d677451d36
commit 1496e33d76
2 changed files with 12 additions and 2 deletions

View File

@ -49,9 +49,18 @@ class MerchantTypeRepository extends BaseRepository
return compact('count', 'list');
}
public function getSelect($getAll = true)
public function getSelect($getAll = true, $siftStore = false)
{
$merTypeIds = $this->userApply ? Merchant::AllowApply : Merchant::AllowDisplay;
// 特殊处理市级云仓
// Merchant::TypeSupplyChain
if ($siftStore == true) {
foreach($merTypeIds as $k=>$v) {
if ($v == Merchant::TypeSupplyChain) {
unset($merTypeIds[$k]);
}
}
}
$query = MerchantType::getDB()->when(!$getAll, function ($query) use ($merTypeIds) {
$query->whereIn('mer_type_id', $merTypeIds);
})->field('mer_type_id,type_name');

View File

@ -160,9 +160,10 @@ class MerchantIntention extends BaseController
public function typeLst()
{
/** @var MerchantTypeRepository $repo */
$siftStore = $this->request->param('sift_store', 0);
$repo = app()->make(MerchantTypeRepository::class);
$repo->userApply = true;
$lst = $repo->getSelect(false);
$lst = $repo->getSelect(false, $siftStore);
return app('json')->success($lst);
}
}