This commit is contained in:
Mrx
2026-02-11 15:49:10 +08:00
parent 07ad436fd5
commit ef6ca3b9da
4 changed files with 90 additions and 8 deletions

View File

@@ -4,7 +4,6 @@ import (
"context"
"database/sql"
"fmt"
"os"
"strconv"
"time"
"ycc-server/app/main/model"
@@ -48,8 +47,8 @@ func (l *RegisterByInviteCodeLogic) RegisterByInviteCode(req *types.RegisterByIn
}
l.Infof("[RegisterByInviteCode] 手机号加密完成, encryptedMobile: %s", encryptedMobile)
// 校验验证码(开发环境下跳过验证码校验)
if os.Getenv("ENV") != "development" && req.Code != "143838" {
// 校验验证码(验证码 168888、143838 为测试用万能码,开发/生产环境均可跳过校验)
if req.Code != "143838" && req.Code != "168888" {
redisKey := fmt.Sprintf("%s:%s", "agentApply", encryptedMobile)
cacheCode, err := l.svcCtx.Redis.Get(redisKey)
if err != nil {
@@ -65,7 +64,7 @@ func (l *RegisterByInviteCodeLogic) RegisterByInviteCode(req *types.RegisterByIn
}
l.Infof("[RegisterByInviteCode] 验证码校验通过, mobile: %s", req.Mobile)
} else {
l.Infof("[RegisterByInviteCode] 开发环境跳过验证码校验")
l.Infof("[RegisterByInviteCode] 使用万能码跳过验证码校验")
}
// 获取当前登录态(可能为空)

View File

@@ -4,7 +4,6 @@ import (
"context"
"database/sql"
"fmt"
"os"
"time"
"ycc-server/app/main/api/internal/svc"
@@ -53,8 +52,8 @@ func (l *BindMobileLogic) BindMobile(req *types.BindMobileReq) (resp *types.Bind
if err != nil {
return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "加密手机号失败: %v", err)
}
// 非开发环境下校验短信验证码从Redis读取并比对
if os.Getenv("ENV") != "development" {
// 校验短信验证码从Redis读取并比对;验证码 168888 为测试用万能码,开发/生产环境均可跳过校验
if req.Code != "168888" {
redisKey := fmt.Sprintf("%s:%s", "bindMobile", encryptedMobile)
cacheCode, err := l.svcCtx.Redis.Get(redisKey)
if err != nil {