| | |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | if params.CodeRule.Method != 1 { |
| | | count, err := model.NewSaleChanceSearch().SetNumber(saleChance.Number).Count() |
| | | if err != nil { |
| | | ctx.FailWithMsg(ecode.UnknownErr, "编码验证失败") |
| | | return |
| | | } |
| | | if count > 0 { |
| | | ctx.FailWithMsg(ecode.UnknownErr, "销售机会编码已存在") |
| | | return |
| | | } |
| | | } |
| | | |
| | | if saleChance.MemberId == 0 { |
| | | userInfo := utils.GetUserInfo(c) |
| | | if userInfo.UserType == constvar.UserTypeSub { |
| | | saleChance.MemberId = userInfo.CrmUserId |
| | | } |
| | | } |
| | | |
| | | errCode = saleChanceService.AddSaleChance(&saleChance) |
| | | if errCode != ecode.OK { |