This commit is contained in:
2026-01-13 16:12:30 +08:00
parent ba7f219882
commit 2bcbede5cd
8 changed files with 131 additions and 37 deletions

View File

@@ -4,6 +4,7 @@ import (
"context"
"database/sql"
"fmt"
"os"
"time"
"tydata-server/app/main/api/internal/svc"
@@ -42,7 +43,14 @@ 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)
}
if req.Mobile != "18889793585" {
// 开发环境固定验证码为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 req.Mobile != "18889793585" {
// 检查手机号是否在一分钟内已发送过验证码
redisKey := fmt.Sprintf("%s:%s", "bindMobile", encryptedMobile)
cacheCode, err := l.svcCtx.Redis.Get(redisKey)