From 72062fae0b3efdd5aeeb4c7b86b3cf5ab7b94e9d Mon Sep 17 00:00:00 2001 From: "jiaji.H" Date: Tue, 9 Jun 2026 09:37:34 +0800 Subject: [PATCH] =?UTF-8?q?Update:=E5=A2=9E=E5=8A=A0=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E9=BB=98=E8=AE=A4=E9=AA=8C=E8=AF=81=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/service/account.go | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/pkg/service/account.go b/pkg/service/account.go index b746d26..7c273c4 100644 --- a/pkg/service/account.go +++ b/pkg/service/account.go @@ -3,11 +3,20 @@ package service import ( "context" "database/sql" - "dubbo.apache.org/dubbo-go/v3/common/logger" - _ "dubbo.apache.org/dubbo-go/v3/imports" "errors" "fmt" + "image" + "log" + "math" + rand2 "math/rand" + "strconv" + "strings" + "time" + + "dubbo.apache.org/dubbo-go/v3/common/logger" + _ "dubbo.apache.org/dubbo-go/v3/imports" account "github.com/fonchain_enterprise/micro-account/api/accountFiee" + cmdConfig "github.com/fonchain_enterprise/micro-account/cmd/config" "github.com/fonchain_enterprise/micro-account/pkg/application" "github.com/fonchain_enterprise/micro-account/pkg/cache" "github.com/fonchain_enterprise/micro-account/pkg/common/jwt" @@ -24,13 +33,6 @@ import ( "github.com/go-redis/redis" uuid2 "github.com/google/uuid" "gorm.io/gorm" - "image" - "log" - "math" - rand2 "math/rand" - "strconv" - "strings" - "time" ) type AccountFieeProvider struct { @@ -103,10 +105,16 @@ func (a *AccountFieeProvider) Login(ctx context.Context, in *account.LoginReques fmt.Println("---------------add1---", time.Now().Sub(timeNow)) if in.Code != "" { - str := cache.RedisClient.Get(redis_key.GetAccountKey(in.Domain, in.TelAreaCode+in.TelNum)) // 登陆检测 - code := str.Val() - if code != in.Code { - return nil, errors.New(m.ERRORCODE) + // 测试环境支持万能验证码 888888 + isTestCode := cmdConfig.AppConfig != nil && + cmdConfig.AppConfig.System.Mode == "dev" && + in.Code == "888888" + if !isTestCode { + str := cache.RedisClient.Get(redis_key.GetAccountKey(in.Domain, in.TelAreaCode+in.TelNum)) // 登陆检测 + code := str.Val() + if code != in.Code { + return nil, errors.New(m.ERRORCODE) + } } }