| | |
| | | return |
| | | } |
| | | |
| | | count, err := model.NewFollowRecordSearch().SetNumber(followRecord.Number).Count() |
| | | if err != nil { |
| | | ctx.FailWithMsg(ecode.UnknownErr, "编码验证失败") |
| | | return |
| | | } |
| | | if count > 0 { |
| | | ctx.FailWithMsg(ecode.UnknownErr, "编码已存在") |
| | | return |
| | | } |
| | | |
| | | if followRecord.MemberId == 0 { |
| | | userInfo := utils.GetUserInfo(c) |
| | | if userInfo.UserType == constvar.UserTypeSub { |
| | |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | if params.FollowRecord.CodeRule.Method == 1 { |
| | | autoCode := model.GetAutoCode(followRecord.Id, ¶ms.FollowRecord.CodeRule) |
| | | m := map[string]interface{}{ |
| | | "number": autoCode, |
| | | } |
| | | _ = model.NewFollowRecordSearch().SetId(followRecord.Id).UpdateMap(m) |
| | | } |
| | | |
| | | ctx.Ok() |