修复:代理在移动端申请时 判断错误导致不能重复申请其他角色,导致配送商不能正常申请的问题

This commit is contained in:
wuhui_zzw 2024-03-26 16:05:16 +08:00
parent f3718e9f7c
commit c8a49e73f6
1 changed files with 11 additions and 11 deletions

View File

@ -122,7 +122,7 @@ class Agent extends BaseController{
if(!in_array((int)$data['agent_type'], [2,3,4,5,6,7,8,9,10,11])) throw new ValidateException('非法请求,代理类型错误!');
if(empty($data['contact_name'])) throw new ValidateException('请输入联系人姓名!');
if(empty($data['contact_phone'])) throw new ValidateException('请输入联系人电话!');
if(!in_array((int)$data['agent_type'], [2,3,4,9,10,11]) && (int)$data['province_id'] <= 0) throw new ValidateException('请选择地区!');
if(!in_array((int)$data['agent_type'], [2,3,4,8,9,10,11]) && (int)$data['province_id'] <= 0) throw new ValidateException('请选择地区!');
if(in_array((int)$data['agent_type'], [5,6,7])){
if((int)$data['city_id'] <= 0) throw new ValidateException('请选择地区!');
if((int)$data['area_id'] <= 0) throw new ValidateException('请选择地区!');
@ -216,16 +216,16 @@ class Agent extends BaseController{
break;
}
// 信息是否重复
$isHas = (int)app()->make(AgentApplyRepository::class)
->getSearchModel(['contact_phone'=>$data['contact_phone']])
->when($agentApplyId > 0,function($query) use ($agentApplyId){
$query->where('id','<>',$agentApplyId);
})->count();
if($isHas > 0) throw new ValidateException('联系人电话已经存在,请勿重复申请!');
$isHas = (int)$this->repository
->getSearchModel(['contact_phone'=>$data['contact_phone']])
->count();
if($isHas > 0) throw new ValidateException('联系人电话已经存在,请勿重复申请!');
// $isHas = (int)app()->make(AgentApplyRepository::class)
// ->getSearchModel(['contact_phone'=>$data['contact_phone']])
// ->when($agentApplyId > 0,function($query) use ($agentApplyId){
// $query->where('id','<>',$agentApplyId);
// })->count();
// if($isHas > 0) throw new ValidateException('联系人电话已经存在,请勿重复申请!');
// $isHas = (int)$this->repository
// ->getSearchModel(['contact_phone'=>$data['contact_phone']])
// ->count();
// if($isHas > 0) throw new ValidateException('联系人电话已经存在,请勿重复申请!');
// 不能 重复成为当前等级的用户
$isHas = (int)$this->repository
->getSearchModel(['agent_type'=>$data['agent_type'],'uid'=>$data['uid']])