作者 陈志颖

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

@@ -122,12 +122,17 @@ func (cooperationApplicationService *CooperationApplicationService) ApplyForCoop @@ -122,12 +122,17 @@ func (cooperationApplicationService *CooperationApplicationService) ApplyForCoop
122 } 122 }
123 123
124 // 校验:判断用户类型是否属于承接对象 124 // 校验:判断用户类型是否属于承接对象
  125 + typeExist := false
125 if !utils.IsContain(cooperationProject.CooperationProjectUndertakerTypes, 3) { // 非公开类型校验 126 if !utils.IsContain(cooperationProject.CooperationProjectUndertakerTypes, 3) { // 非公开类型校验
126 for _, userType := range cooperationProject.CooperationProjectUndertakerTypes { 127 for _, userType := range cooperationProject.CooperationProjectUndertakerTypes {
127 - if !utils.IsContain(cooperationProject.CooperationProjectUndertakerTypes, applicant.UserType&userType) {  
128 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "抱歉,您不属于当前项目的承接对象") 128 + if utils.IsContain(cooperationProject.CooperationProjectUndertakerTypes, applicant.UserType&userType) {
  129 + typeExist = true
129 } 130 }
130 } 131 }
  132 + if !typeExist {
  133 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "抱歉,您不属于当前项目的承接对象")
  134 +
  135 + }
131 } 136 }
132 137
133 newCooperationApplication = &domain.CooperationApplication{ 138 newCooperationApplication = &domain.CooperationApplication{
@@ -184,8 +189,16 @@ func (cooperationApplicationService *CooperationApplicationService) ApplyForCoop @@ -184,8 +189,16 @@ func (cooperationApplicationService *CooperationApplicationService) ApplyForCoop
184 } 189 }
185 190
186 // 校验:判断用户类型是否属于承接对象 191 // 校验:判断用户类型是否属于承接对象
187 - if !utils.IsContain(cooperationProject.CooperationProjectUndertakerTypes, applicant.UserType) {  
188 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "抱歉,您不属于当前项目的承接对象") 192 + typeExist := false
  193 + if !utils.IsContain(cooperationProject.CooperationProjectUndertakerTypes, 3) { // 非公开类型校验
  194 + for _, userType := range cooperationProject.CooperationProjectUndertakerTypes {
  195 + if utils.IsContain(cooperationProject.CooperationProjectUndertakerTypes, applicant.UserType&userType) {
  196 + typeExist = true
  197 + }
  198 + }
  199 + if !typeExist {
  200 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "抱歉,您不属于当前项目的承接对象")
  201 + }
189 } 202 }
190 203
191 newCooperationApplication = &domain.CooperationApplication{ 204 newCooperationApplication = &domain.CooperationApplication{