作者 陈志颖

fix:修复共创申请人类型校验

... ... @@ -122,12 +122,17 @@ func (cooperationApplicationService *CooperationApplicationService) ApplyForCoop
}
// 校验:判断用户类型是否属于承接对象
typeExist := false
if !utils.IsContain(cooperationProject.CooperationProjectUndertakerTypes, 3) { // 非公开类型校验
for _, userType := range cooperationProject.CooperationProjectUndertakerTypes {
if !utils.IsContain(cooperationProject.CooperationProjectUndertakerTypes, applicant.UserType&userType) {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "抱歉,您不属于当前项目的承接对象")
if utils.IsContain(cooperationProject.CooperationProjectUndertakerTypes, applicant.UserType&userType) {
typeExist = true
}
}
if !typeExist {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "抱歉,您不属于当前项目的承接对象")
}
}
newCooperationApplication = &domain.CooperationApplication{
... ... @@ -184,9 +189,17 @@ func (cooperationApplicationService *CooperationApplicationService) ApplyForCoop
}
// 校验:判断用户类型是否属于承接对象
if !utils.IsContain(cooperationProject.CooperationProjectUndertakerTypes, applicant.UserType) {
typeExist := false
if !utils.IsContain(cooperationProject.CooperationProjectUndertakerTypes, 3) { // 非公开类型校验
for _, userType := range cooperationProject.CooperationProjectUndertakerTypes {
if utils.IsContain(cooperationProject.CooperationProjectUndertakerTypes, applicant.UserType&userType) {
typeExist = true
}
}
if !typeExist {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "抱歉,您不属于当前项目的承接对象")
}
}
newCooperationApplication = &domain.CooperationApplication{
CooperationApplicationApplicant: applicant,
... ...