This commit is contained in:
Mrx
2026-01-26 15:47:59 +08:00
parent 018abc95d6
commit 67082972a9
8 changed files with 17 additions and 16 deletions

View File

@@ -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)