diff --git a/app/mix/service/business_validator/login.go b/app/mix/service/business_validator/login.go index af3c5533..7040e81e 100644 --- a/app/mix/service/business_validator/login.go +++ b/app/mix/service/business_validator/login.go @@ -111,6 +111,16 @@ func (l *LoginBusinessValidator) EnsureVeriCodeWrongTimesNotReachedDailyUpperbou l.oplist = append(l.oplist, func() { if l.login != nil { + + wrongTimes, err := fun(l.ctx, l.login.GetMid()) + if err != nil { + l.ec = errcode.ErrCodeVeriCodeWrongTimesSrvFail + return + } + if wrongTimes == nil { + return + } + // 读取每日错误上限 maxDailyWrongTimes, err := apollo.GetIntValue(consts.MaxVeriCodeWrongTimesKey, apollo.ApolloOpts().SetNamespace("application")) if err != nil { @@ -119,12 +129,6 @@ func (l *LoginBusinessValidator) EnsureVeriCodeWrongTimesNotReachedDailyUpperbou return } - wrongTimes, err := fun(l.ctx, l.login.GetMid()) - if err != nil { - l.ec = errcode.ErrCodeVeriCodeWrongTimesSrvFail - return - } - if wrongTimes.WrongTimes >= int64(maxDailyWrongTimes) { logger.Error("wrongs times of verification code of this mid has reached its daily upperbound") l.ec = errcode.ErrCodeVeriCodeWrongTimesReachedDailyUpperbound