This commit is contained in:
Mrx
2026-01-26 17:35:44 +08:00
parent 1201aab68b
commit f867e603f0
21 changed files with 813 additions and 111 deletions

View File

@@ -38,15 +38,8 @@ func (l *MobileCodeLoginLogic) MobileCodeLogin(req *types.MobileCodeLoginReq) (r
if err != nil {
return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "手机登录, 加密手机号失败: %+v", err)
}
// 开发环境固定验证码为138888
env := os.Getenv("ENV")
if env == "development" {
if req.Code != "138888" {
return nil, errors.Wrapf(xerr.NewErrMsg("验证码不正确"), "开发环境验证码应为138888")
}
logx.Infof("开发环境:验证码验证通过 %s", req.Mobile)
} else {
// 开发环境下跳过验证码验证
if os.Getenv("ENV") != "development" {
// 检查手机号是否在一分钟内已发送过验证码
redisKey := fmt.Sprintf("%s:%s", "login", encryptedMobile)
cacheCode, err := l.svcCtx.Redis.Get(redisKey)