From fb3050399758f8f975c60e07202d6dff131a16f7 Mon Sep 17 00:00:00 2001 From: liangzai <2440983361@qq.com> Date: Thu, 14 Aug 2025 14:33:44 +0800 Subject: [PATCH] fix --- .../internal/logic/query/queryservicelogic.go | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/app/main/api/internal/logic/query/queryservicelogic.go b/app/main/api/internal/logic/query/queryservicelogic.go index 9393b40..13124b9 100644 --- a/app/main/api/internal/logic/query/queryservicelogic.go +++ b/app/main/api/internal/logic/query/queryservicelogic.go @@ -78,8 +78,27 @@ func (l *QueryServiceLogic) VerifyCode(mobile string, code string) error { // 三要素验证 func (l *QueryServiceLogic) Verify(Name string, IDCard string, Mobile string) error { fmt.Println("Mobile", Mobile) - // 三要素验证 - return l.VerifyTwoFactors(Name, IDCard) + // 下午18点到次日早上8点半调用二要素,其余时间三要素 + now := time.Now() + // 获取当前小时和分钟 + hour := now.Hour() + minute := now.Minute() + + // 判断是否在18:00到次日8:30之间 + if hour >= 18 || (hour < 8) || (hour == 8 && minute < 30) { + // 二要素验证 + twoFactorsErr := l.VerifyTwoFactors(Name, IDCard) + if twoFactorsErr != nil { + return twoFactorsErr + } + } else { + // 三要素验证 + threeFactorsErr := l.VerifyThreeFactors(Name, IDCard, Mobile) + if threeFactorsErr != nil { + return threeFactorsErr + } + } + return nil } // VerifyTwoFactors 二要素验证