fix updateUserInfoEx

pull/1635/head
AndrewZuo01 2 years ago
parent b39d12aacf
commit d941c69770

@ -4,7 +4,7 @@ go 1.19
require ( require (
firebase.google.com/go v3.13.0+incompatible firebase.google.com/go v3.13.0+incompatible
github.com/OpenIMSDK/protocol v0.0.40 github.com/OpenIMSDK/protocol v0.0.42
github.com/OpenIMSDK/tools v0.0.21 github.com/OpenIMSDK/tools v0.0.21
github.com/bwmarrin/snowflake v0.3.0 // indirect github.com/bwmarrin/snowflake v0.3.0 // indirect
github.com/dtm-labs/rockscache v0.1.1 github.com/dtm-labs/rockscache v0.1.1

@ -168,7 +168,7 @@ func (s *userServer) UpdateUserInfoEx(ctx context.Context, req *pbuser.UpdateUse
if err != nil { if err != nil {
return nil, err return nil, err
} }
if req.UserInfo.Nickname != "" || req.UserInfo.FaceURL != "" { if req.UserInfo.Nickname != nil || req.UserInfo.FaceURL != nil {
if err := s.groupRpcClient.NotificationUserInfoUpdate(ctx, req.UserInfo.UserID); err != nil { if err := s.groupRpcClient.NotificationUserInfoUpdate(ctx, req.UserInfo.UserID); err != nil {
log.ZError(ctx, "NotificationUserInfoUpdate", err) log.ZError(ctx, "NotificationUserInfoUpdate", err)
} }

@ -79,14 +79,18 @@ func UserPb2DBMapEx(user *sdkws.UserInfoWithEx) map[string]any {
val := make(map[string]any) val := make(map[string]any)
// Map fields from UserInfoWithEx to val // Map fields from UserInfoWithEx to val
val["nickname"] = user.Nickname
val["face_url"] = user.FaceURL
if user.Nickname != nil {
val["nickname"] = user.Nickname.Value
}
if user.FaceURL != nil {
val["face_url"] = user.FaceURL.Value
}
if user.Ex != nil { if user.Ex != nil {
val["ex"] = user.Ex.Value val["ex"] = user.Ex.Value
} }
if user.GlobalRecvMsgOpt != 0 { if user.GlobalRecvMsgOpt != nil {
val["global_recv_msg_opt"] = user.GlobalRecvMsgOpt val["global_recv_msg_opt"] = user.GlobalRecvMsgOpt.Value
} }
return val return val

Loading…
Cancel
Save