fix
This commit is contained in:
@@ -77,37 +77,50 @@ func (l *QueryServiceLogic) VerifyCode(mobile string, code string) error {
|
|||||||
|
|
||||||
// 三要素验证
|
// 三要素验证
|
||||||
func (l *QueryServiceLogic) Verify(Name string, IDCard string, Mobile string) error {
|
func (l *QueryServiceLogic) Verify(Name string, IDCard string, Mobile string) error {
|
||||||
now := time.Now()
|
if l.svcCtx.Config.VerifyConfig.TwoFactor {
|
||||||
hour := now.Hour()
|
|
||||||
minute := now.Minute()
|
|
||||||
|
|
||||||
// 判断当前时间是否在三要素验证时间段内
|
|
||||||
// 上午8:30-12:00,下午14:30-18:30为三要素,其余为二要素
|
|
||||||
isThreeFactor := false
|
|
||||||
|
|
||||||
// 上午8:30-12:00
|
|
||||||
if (hour == 8 && minute >= 30) || (hour > 8 && hour < 12) || (hour == 12 && minute == 0) {
|
|
||||||
isThreeFactor = true
|
|
||||||
}
|
|
||||||
// 下午14:30-18:00
|
|
||||||
if (hour == 14 && minute >= 30) || (hour > 14 && hour < 18) || (hour == 18 && minute == 0) {
|
|
||||||
isThreeFactor = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if isThreeFactor {
|
|
||||||
// 三要素验证
|
|
||||||
threeFactorsErr := l.VerifyThreeFactors(Name, IDCard, Mobile)
|
|
||||||
if threeFactorsErr != nil {
|
|
||||||
return threeFactorsErr
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 二要素验证
|
|
||||||
twoFactorsErr := l.VerifyTwoFactors(Name, IDCard)
|
twoFactorsErr := l.VerifyTwoFactors(Name, IDCard)
|
||||||
if twoFactorsErr != nil {
|
if twoFactorsErr != nil {
|
||||||
return twoFactorsErr
|
return twoFactorsErr
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
threeFactorsErr := l.VerifyThreeFactors(Name, IDCard, Mobile)
|
||||||
|
if threeFactorsErr != nil {
|
||||||
|
return threeFactorsErr
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
// ===========================================================
|
||||||
|
// now := time.Now()
|
||||||
|
// hour := now.Hour()
|
||||||
|
// minute := now.Minute()
|
||||||
|
|
||||||
|
// // 判断当前时间是否在三要素验证时间段内
|
||||||
|
// // 上午8:30-12:00,下午14:30-18:30为三要素,其余为二要素
|
||||||
|
// isThreeFactor := false
|
||||||
|
|
||||||
|
// // 上午8:30-12:00
|
||||||
|
// if (hour == 8 && minute >= 30) || (hour > 8 && hour < 12) || (hour == 12 && minute == 0) {
|
||||||
|
// isThreeFactor = true
|
||||||
|
// }
|
||||||
|
// // 下午14:30-18:00
|
||||||
|
// if (hour == 14 && minute >= 30) || (hour > 14 && hour < 18) || (hour == 18 && minute == 0) {
|
||||||
|
// isThreeFactor = true
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if isThreeFactor {
|
||||||
|
// // 三要素验证
|
||||||
|
// threeFactorsErr := l.VerifyThreeFactors(Name, IDCard, Mobile)
|
||||||
|
// if threeFactorsErr != nil {
|
||||||
|
// return threeFactorsErr
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// // 二要素验证
|
||||||
|
// twoFactorsErr := l.VerifyTwoFactors(Name, IDCard)
|
||||||
|
// if twoFactorsErr != nil {
|
||||||
|
// return twoFactorsErr
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// VerifyTwoFactors 二要素验证
|
// VerifyTwoFactors 二要素验证
|
||||||
|
|||||||
Reference in New Issue
Block a user