diff --git a/app/main/api/etc/main.dev.yaml b/app/main/api/etc/main.dev.yaml index 1434348..30994a3 100644 --- a/app/main/api/etc/main.dev.yaml +++ b/app/main/api/etc/main.dev.yaml @@ -63,8 +63,6 @@ Ali: SystemConfig: ThreeVerify: false CommissionSafeMode: false # 佣金安全防御模式:true-冻结模式,false-直接结算模式 - SkipVerifyCode: true # 开发环境下跳过验证码验证 - SkipVerify: true # 空报告模式:开发环境跳过二/三要素验证(避免未授权IP调用天元API失败) WechatH5: AppID: "wxa581992dc74d860e" AppSecret: "4de1fbf521712247542d49907fcd5dbf" diff --git a/app/main/api/etc/main.yaml b/app/main/api/etc/main.yaml index 9dd9009..084ccf0 100644 --- a/app/main/api/etc/main.yaml +++ b/app/main/api/etc/main.yaml @@ -64,8 +64,6 @@ Ali: SystemConfig: ThreeVerify: true CommissionSafeMode: false # 佣金安全防御模式:true-冻结模式,false-直接结算模式 - SkipVerifyCode: false # 开发环境下跳过验证码验证 - SkipVerify: false # 空报告模式:开发环境跳过二/三要素验证(避免未授权IP调用天元API失败) WechatH5: AppID: "wxa581992dc74d860e" AppSecret: "4de1fbf521712247542d49907fcd5dbf" diff --git a/app/main/api/internal/config/config.go b/app/main/api/internal/config/config.go index 357d3bc..b8fac11 100644 --- a/app/main/api/internal/config/config.go +++ b/app/main/api/internal/config/config.go @@ -94,8 +94,6 @@ type YushanConfig struct { type SystemConfig struct { ThreeVerify bool // 是否开启三级实名认证 CommissionSafeMode bool // 佣金安全防御模式:true-冻结模式(status=1,进入frozen_balance),false-直接结算(status=0,进入balance) - SkipVerifyCode bool // 开发环境下跳过验证码验证 - SkipVerify bool // 空报告模式:开发环境下跳过二/三要素验证(避免未授权IP调用天元API失败) } type WechatH5Config struct { AppID string diff --git a/app/main/api/internal/logic/agent/agentrealnamelogic.go b/app/main/api/internal/logic/agent/agentrealnamelogic.go index 53a3188..88973b1 100644 --- a/app/main/api/internal/logic/agent/agentrealnamelogic.go +++ b/app/main/api/internal/logic/agent/agentrealnamelogic.go @@ -4,6 +4,7 @@ import ( "context" "database/sql" "fmt" + "os" "time" "tydata-server/app/main/api/internal/service" @@ -44,7 +45,7 @@ func (l *AgentRealNameLogic) AgentRealName(req *types.AgentRealNameReq) (resp *t return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "代理实名, 加密手机号失败: %v", err) } // 开发环境下跳过验证码验证 - if !l.svcCtx.Config.SystemConfig.SkipVerifyCode { + if os.Getenv("ENV") != "development" { // 检查手机号是否在一分钟内已发送过验证码 redisKey := fmt.Sprintf("%s:%s", "realName", encryptedMobile) cacheCode, err := l.svcCtx.Redis.Get(redisKey) diff --git a/app/main/api/internal/logic/agent/applyforagentlogic.go b/app/main/api/internal/logic/agent/applyforagentlogic.go index 2c078b2..da88cb4 100644 --- a/app/main/api/internal/logic/agent/applyforagentlogic.go +++ b/app/main/api/internal/logic/agent/applyforagentlogic.go @@ -4,6 +4,7 @@ import ( "context" "database/sql" "fmt" + "os" "time" "tydata-server/app/main/model" "tydata-server/common/ctxdata" @@ -45,7 +46,7 @@ func (l *ApplyForAgentLogic) ApplyForAgent(req *types.AgentApplyReq) (resp *type return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "加密手机号失败: %v", err) } // 开发环境下跳过验证码验证,或者特定手机号跳过(保留原有逻辑) - if !l.svcCtx.Config.SystemConfig.SkipVerifyCode && req.Mobile != "18889793585" { + if os.Getenv("ENV") != "development" && req.Mobile != "18889793585" { // 校验验证码 redisKey := fmt.Sprintf("%s:%s", "agentApply", encryptedMobile) cacheCode, err := l.svcCtx.Redis.Get(redisKey) diff --git a/app/main/api/internal/logic/query/queryservicelogic.go b/app/main/api/internal/logic/query/queryservicelogic.go index d030827..e466432 100644 --- a/app/main/api/internal/logic/query/queryservicelogic.go +++ b/app/main/api/internal/logic/query/queryservicelogic.go @@ -6,6 +6,7 @@ import ( "encoding/hex" "encoding/json" "fmt" + "os" "time" "tydata-server/app/main/api/internal/service" "tydata-server/app/main/model" @@ -561,7 +562,7 @@ func (l *QueryServiceLogic) DecryptData(data string) ([]byte, error) { // 校验验证码 func (l *QueryServiceLogic) VerifyCode(mobile string, code string) error { // 开发环境下跳过验证码验证 - if l.svcCtx.Config.SystemConfig.SkipVerifyCode { + if os.Getenv("ENV") == "development" { return nil } secretKey := l.svcCtx.Config.Encrypt.SecretKey @@ -585,10 +586,12 @@ func (l *QueryServiceLogic) VerifyCode(mobile string, code string) error { // 二、三要素验证 func (l *QueryServiceLogic) Verify(Name string, IDCard string, Mobile string) error { - // 空报告模式:开发环境下跳过二/三要素验证 - if l.svcCtx.Config.SystemConfig.SkipVerify { + // 开发环境下跳过二/三要素验证(避免未授权IP调用天元API失败) + isDevelopment := os.Getenv("ENV") == "development" + if isDevelopment { return nil } + if !l.svcCtx.Config.SystemConfig.ThreeVerify { twoVerification := service.TwoFactorVerificationRequest{ Name: Name, diff --git a/app/main/api/internal/logic/user/bindmobilelogic.go b/app/main/api/internal/logic/user/bindmobilelogic.go index cd05e14..2d62599 100644 --- a/app/main/api/internal/logic/user/bindmobilelogic.go +++ b/app/main/api/internal/logic/user/bindmobilelogic.go @@ -4,6 +4,7 @@ import ( "context" "database/sql" "fmt" + "os" "time" "tydata-server/app/main/api/internal/svc" @@ -43,7 +44,7 @@ func (l *BindMobileLogic) BindMobile(req *types.BindMobileReq) (resp *types.Bind return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "绑定手机号, 加密手机号失败: %v", err) } // 开发环境下跳过验证码验证,或者特定手机号跳过(保留原有逻辑) - if !l.svcCtx.Config.SystemConfig.SkipVerifyCode && req.Mobile != "18889793585" { + if os.Getenv("ENV") != "development" && req.Mobile != "18889793585" { // 检查手机号是否在一分钟内已发送过验证码 redisKey := fmt.Sprintf("%s:%s", "bindMobile", encryptedMobile) cacheCode, err := l.svcCtx.Redis.Get(redisKey) diff --git a/app/main/api/internal/logic/user/mobilecodeloginlogic.go b/app/main/api/internal/logic/user/mobilecodeloginlogic.go index cb602a5..2775349 100644 --- a/app/main/api/internal/logic/user/mobilecodeloginlogic.go +++ b/app/main/api/internal/logic/user/mobilecodeloginlogic.go @@ -2,14 +2,15 @@ package user import ( "context" + "database/sql" + "fmt" + "os" + "time" "tydata-server/app/main/api/internal/svc" "tydata-server/app/main/api/internal/types" "tydata-server/app/main/model" "tydata-server/common/xerr" "tydata-server/pkg/lzkit/crypto" - "database/sql" - "fmt" - "time" "github.com/pkg/errors" "github.com/zeromicro/go-zero/core/stores/redis" @@ -38,7 +39,7 @@ func (l *MobileCodeLoginLogic) MobileCodeLogin(req *types.MobileCodeLoginReq) (r return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "手机登录, 加密手机号失败: %+v", err) } // 开发环境下跳过验证码验证 - if !l.svcCtx.Config.SystemConfig.SkipVerifyCode { + if os.Getenv("ENV") != "development" { // 检查手机号是否在一分钟内已发送过验证码 redisKey := fmt.Sprintf("%s:%s", "login", encryptedMobile) cacheCode, err := l.svcCtx.Redis.Get(redisKey)