Compare commits

...

2 Commits

Author SHA1 Message Date
e5a53eebbc fix 2025-08-16 13:08:37 +08:00
053a302c80 fix 2025-08-16 13:06:51 +08:00
4 changed files with 12 additions and 8 deletions

View File

@@ -90,3 +90,5 @@ Tianyuanapi:
Key: "2732f526167c2de9b8dc6aa0f24ba8b7" Key: "2732f526167c2de9b8dc6aa0f24ba8b7"
BaseURL: "https://api.tianyuanapi.com" BaseURL: "https://api.tianyuanapi.com"
Timeout: 60 Timeout: 60
VerifyConfig:
TwoFactor: true

View File

@@ -77,3 +77,5 @@ Tianyuanapi:
Key: "2732f526167c2de9b8dc6aa0f24ba8b7" Key: "2732f526167c2de9b8dc6aa0f24ba8b7"
BaseURL: "https://api.tianyuanapi.com" BaseURL: "https://api.tianyuanapi.com"
Timeout: 60 Timeout: 60
VerifyConfig:
TwoFactor: true

View File

@@ -23,6 +23,7 @@ type Config struct {
AdminPromotion AdminPromotion AdminPromotion AdminPromotion
CleanTask CleanTask CleanTask CleanTask
Tianyuanapi TianyuanapiConfig Tianyuanapi TianyuanapiConfig
VerifyConfig VerifyConfig
} }
// JwtAuth 用于 JWT 鉴权配置 // JwtAuth 用于 JWT 鉴权配置
@@ -112,3 +113,6 @@ type TianyuanapiConfig struct {
BaseURL string BaseURL string
Timeout int64 Timeout int64
} }
type VerifyConfig struct {
TwoFactor bool
}

View File

@@ -77,15 +77,11 @@ 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 {
fmt.Println("Mobile", Mobile) // 2025年8月18日上午8点30分之前都是二要素过后是三要素
// 下午18点到次日早上8点半调用二要素其余时间三要素
now := time.Now() now := time.Now()
// 获取当前小时和分钟 // 设定分界时间2025年8月18日8点30分
hour := now.Hour() switchTime := time.Date(2025, 8, 18, 8, 30, 0, 0, now.Location())
minute := now.Minute() if now.Before(switchTime) {
// 判断是否在18:00到次日8:30之间
if hour >= 18 || (hour < 8) || (hour == 8 && minute < 30) {
// 二要素验证 // 二要素验证
twoFactorsErr := l.VerifyTwoFactors(Name, IDCard) twoFactorsErr := l.VerifyTwoFactors(Name, IDCard)
if twoFactorsErr != nil { if twoFactorsErr != nil {