三端用户手机号联通,增加临时用户
This commit is contained in:
		| @@ -30,10 +30,23 @@ func NewDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DetailLogi | ||||
| } | ||||
|  | ||||
| func (l *DetailLogic) Detail() (resp *types.UserInfoResp, err error) { | ||||
| 	userID, err := ctxdata.GetUidFromCtx(l.ctx) | ||||
| 	claims, err := ctxdata.GetClaimsFromCtx(l.ctx) | ||||
| 	if err != nil { | ||||
| 		return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "用户信息, %v", err) | ||||
| 	} | ||||
|  | ||||
| 	userID := claims.UserId | ||||
| 	userType := claims.UserType | ||||
| 	if userType == model.UserTypeTemp { | ||||
| 		return &types.UserInfoResp{ | ||||
| 			UserInfo: types.User{ | ||||
| 				Id:       userID, | ||||
| 				UserType: userType, | ||||
| 				Mobile:   "", | ||||
| 				NickName: "", | ||||
| 			}, | ||||
| 		}, nil | ||||
| 	} | ||||
| 	user, err := l.svcCtx.UserModel.FindOne(l.ctx, userID) | ||||
| 	if err != nil { | ||||
| 		if errors.Is(err, model.ErrNotFound) { | ||||
| @@ -46,12 +59,15 @@ func (l *DetailLogic) Detail() (resp *types.UserInfoResp, err error) { | ||||
| 	if err != nil { | ||||
| 		return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "用户信息, 用户信息结构体复制失败, %v", err) | ||||
| 	} | ||||
|  | ||||
| 	if user.Mobile.Valid { | ||||
| 		userInfo.Mobile, err = crypto.DecryptMobile(user.Mobile.String, l.svcCtx.Config.Encrypt.SecretKey) | ||||
| 		if err != nil { | ||||
| 			return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "用户信息, 解密手机号失败, %v", err) | ||||
| 		} | ||||
| 	} | ||||
| 	userInfo.UserType = claims.UserType | ||||
|  | ||||
| 	return &types.UserInfoResp{ | ||||
| 		UserInfo: userInfo, | ||||
| 	}, nil | ||||
|   | ||||
		Reference in New Issue
	
	Block a user