修改用户可以申请的店铺类型
This commit is contained in:
parent
29b20cbedd
commit
035f49be5c
@ -45,6 +45,16 @@ class Merchant extends BaseModel
|
|||||||
self::TypeVillageServer => '村服务团队',
|
self::TypeVillageServer => '村服务团队',
|
||||||
self::TypeTownServer => '镇服务团队',
|
self::TypeTownServer => '镇服务团队',
|
||||||
];
|
];
|
||||||
|
const AllowApply = [ //允许申请的类型
|
||||||
|
self::TypeStore,
|
||||||
|
self::TypeSupplyChain,
|
||||||
|
];
|
||||||
|
const AllowDisplay = [ //允许展示的类型
|
||||||
|
self::TypeStore,
|
||||||
|
self::TypeCloudWarehouse,
|
||||||
|
self::TypeSupplyChain,
|
||||||
|
self::TypePlatform,
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
|
@ -29,6 +29,9 @@ use think\facade\Route;
|
|||||||
*/
|
*/
|
||||||
class MerchantTypeRepository extends BaseRepository
|
class MerchantTypeRepository extends BaseRepository
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public $userApply = false;
|
||||||
|
|
||||||
public function __construct(MerchantTypeDao $dao)
|
public function __construct(MerchantTypeDao $dao)
|
||||||
{
|
{
|
||||||
$this->dao = $dao;
|
$this->dao = $dao;
|
||||||
@ -48,8 +51,9 @@ class MerchantTypeRepository extends BaseRepository
|
|||||||
|
|
||||||
public function getSelect($getAll = true)
|
public function getSelect($getAll = true)
|
||||||
{
|
{
|
||||||
$query = MerchantType::getDB()->when(!$getAll, function ($query) {
|
$merTypeIds = $this->userApply ? Merchant::AllowApply : Merchant::AllowDisplay;
|
||||||
$query->whereIn('mer_type_id', [Merchant::TypeCloudWarehouse, Merchant::TypeStore, Merchant::TypeSupplyChain, Merchant::TypePlatform]);
|
$query = MerchantType::getDB()->when(!$getAll, function ($query) use ($merTypeIds) {
|
||||||
|
$query->whereIn('mer_type_id', $merTypeIds);
|
||||||
})->field('mer_type_id,type_name');
|
})->field('mer_type_id,type_name');
|
||||||
return $query->select()->toArray();
|
return $query->select()->toArray();
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,10 @@ class MerchantIntention extends BaseController
|
|||||||
|
|
||||||
public function typeLst()
|
public function typeLst()
|
||||||
{
|
{
|
||||||
$lst = app()->make(MerchantTypeRepository::class)->getSelect(false);
|
/** @var MerchantTypeRepository $repo */
|
||||||
|
$repo = app()->make(MerchantTypeRepository::class);
|
||||||
|
$repo->userApply = true;
|
||||||
|
$lst = $repo->getSelect(false);
|
||||||
return app('json')->success($lst);
|
return app('json')->success($lst);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user