优化:商户入驻隐藏部分必填项 减少入驻填写信息

This commit is contained in:
wuhui_zzw 2024-07-12 14:10:54 +08:00
parent a7aab6174b
commit 27933547a9
1 changed files with 6 additions and 6 deletions

View File

@ -41,6 +41,7 @@ class MerchantIntention extends BaseController
if($make->fieldExists('mer_phone',$data['phone'])) throw new ValidateException('手机号已存在,不可申请');
$adminRepository = app()->make(MerchantAdminRepository::class);
if($adminRepository->fieldExists('account',$data['phone'])) throw new ValidateException('手机号已是管理员,不可申请');
$intention = $this->repository->create($data);
SwooleTaskService::admin('notice',[
'type' => 'new_intention',
@ -100,25 +101,24 @@ class MerchantIntention extends BaseController
protected function checkParams($id = 0){
// 参数获取
$data = $this->request->params(['phone','mer_name','name','code','images','merchant_category_id','mer_type_id','manage_uid',['agent_id', 0],['merchant_type',0],['merchant_sub_type',0]]);
app()->make(MerchantIntentionValidate::class)->check($data);
// app()->make(MerchantIntentionValidate::class)->check($data);
// $check = app()->make(SmsService::class)->checkSmsCode($data['phone'],$data['code'],'intention');
$data['mer_type_id'] = (int)$data['mer_type_id'];
// if(!$check) throw new ValidateException('验证码不正确');
if(!in_array((int)$data['merchant_type'],[1,3,4,5,6,7])){
/*if(!in_array((int)$data['merchant_type'],[1,3,4,5,6,7])){
// 判断:商户分类是否存在
$cateIsHas = app()->make(MerchantCategoryRepository::class)->get($data['merchant_category_id']);
if(!$cateIsHas) throw new ValidateException('商户分类不存在');
// 判断:商户类型是否存在
$typeIsHas = app()->make(MerchantTypeRepository::class)->exists($data['mer_type_id']);
if($data['mer_type_id'] && !$typeIsHas) throw new ValidateException('店铺类型不存在');
}
}*/
// 判断:当前管理员身份是否有效
$isService = app()->make(StoreServiceRepository::class)->isService($data['manage_uid'], $id, 1);// 是否存在店员信息
$isService = app()->make(StoreServiceRepository::class)->isService($data['manage_uid'], $id, 1, $data['merchant_type']);// 是否存在店员信息
if($isService) throw new ValidateException('管理员身份无效,已成为其他商户管理员或店员!');
$isManage = app()->make(repository::class)->isManage($data['manage_uid'], $id);// 是否存在审核中店长信息
$isManage = app()->make(repository::class)->isManage($data['manage_uid'], $id, $data['merchant_type']);// 是否存在审核中店长信息
if($isManage) throw new ValidateException('管理员身份无效,已成为其他商户管理员!');
unset($data['code']);
return $data;
}