fix err
This commit is contained in:
parent
68a8d7ee4d
commit
585bb05c6a
@ -66,6 +66,17 @@ func (l *BindMobileLogic) BindMobile(req *types.BindMobileReq) (resp *types.Bind
|
|||||||
if claims != nil {
|
if claims != nil {
|
||||||
if req.Mobile != "18889793585" {
|
if req.Mobile != "18889793585" {
|
||||||
if claims.UserType == model.UserTypeTemp {
|
if claims.UserType == model.UserTypeTemp {
|
||||||
|
userTemp, err := l.svcCtx.UserTempModel.FindOne(l.ctx, claims.UserId)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "绑定手机号, 读取临时用户失败: %v", err)
|
||||||
|
}
|
||||||
|
userAuth, err := l.svcCtx.UserAuthModel.FindOneByUserIdAuthType(l.ctx, user.Id, userTemp.AuthType)
|
||||||
|
if err != nil && !errors.Is(err, model.ErrNotFound) {
|
||||||
|
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "绑定手机号, 读取用户认证失败: %v", err)
|
||||||
|
}
|
||||||
|
if userAuth != nil && userAuth.AuthKey != userTemp.AuthKey {
|
||||||
|
return nil, errors.Wrapf(xerr.NewErrMsg("该手机号已绑定其他微信号"), "绑定手机号, 临时用户已注册: %s", encryptedMobile)
|
||||||
|
}
|
||||||
err = l.svcCtx.UserService.TempUserBindUser(l.ctx, nil, user.Id)
|
err = l.svcCtx.UserService.TempUserBindUser(l.ctx, nil, user.Id)
|
||||||
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)
|
||||||
|
@ -5,11 +5,11 @@ var message map[uint32]string
|
|||||||
func init() {
|
func init() {
|
||||||
message = make(map[uint32]string)
|
message = make(map[uint32]string)
|
||||||
message[OK] = "SUCCESS"
|
message[OK] = "SUCCESS"
|
||||||
message[SERVER_COMMON_ERROR] = "服务器开小差啦,稍后再来试一试"
|
message[SERVER_COMMON_ERROR] = "系统正在升级,请稍后再试"
|
||||||
message[REUQEST_PARAM_ERROR] = "参数错误"
|
message[REUQEST_PARAM_ERROR] = "参数错误"
|
||||||
message[TOKEN_EXPIRE_ERROR] = "token失效,请重新登陆"
|
message[TOKEN_EXPIRE_ERROR] = "token失效,请重新登陆"
|
||||||
message[TOKEN_GENERATE_ERROR] = "生成token失败"
|
message[TOKEN_GENERATE_ERROR] = "生成token失败"
|
||||||
message[DB_ERROR] = "数据库繁忙,请稍后再试"
|
message[DB_ERROR] = "系统维护升级中,请稍后再试"
|
||||||
message[DB_UPDATE_AFFECTED_ZERO_ERROR] = "更新数据影响行数为0"
|
message[DB_UPDATE_AFFECTED_ZERO_ERROR] = "更新数据影响行数为0"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ func MapErrMsg(errcode uint32) string {
|
|||||||
if msg, ok := message[errcode]; ok {
|
if msg, ok := message[errcode]; ok {
|
||||||
return msg
|
return msg
|
||||||
} else {
|
} else {
|
||||||
return "服务器开小差啦,稍后再来试一试"
|
return "系统正在升级,请稍后再试"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
func TestAesEcbMobileEncryption(t *testing.T) {
|
func TestAesEcbMobileEncryption(t *testing.T) {
|
||||||
// 测试手机号加密
|
// 测试手机号加密
|
||||||
mobile := "13417317775"
|
mobile := "18653052547"
|
||||||
key := []byte("ff83609b2b24fc73196aac3d3dfb874f") // 16字节AES-128密钥
|
key := []byte("ff83609b2b24fc73196aac3d3dfb874f") // 16字节AES-128密钥
|
||||||
|
|
||||||
keyStr := hex.EncodeToString(key)
|
keyStr := hex.EncodeToString(key)
|
||||||
|
Loading…
Reference in New Issue
Block a user