Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[BUG] update the defect of the userinfo api #700

@volencez

Description

@volencez

OpenIM Server Version

1.8.4

Operating System and CPU Architecture

macOS (ARM)

Deployment Method

Source Code Deployment

Bug Description and Steps to Reproduce

/user/update的借口存在以下问题:

  1. 请求参数:{"areaCode":"+86","phoneNumber":"11111111111","userID":"5653004779","platform":1}
  2. 下面是修改用户信息的代码,只对area_code进行了修改,没有对phone_number进行修改,并且返回了修改成功,这个修改将毫无意义,如果不支持手机修改,那为什么要支持修改area_code,显然这里缺少了update["phone_number"] = req.PhoneNumber.Value,请关注并尽快修复,谢谢

func ToDBAttributeUpdate(req *chat.UpdateUserInfoReq) (map[string]any, error) {
update := make(map[string]any)
if req.Account != nil {
update["account"] = req.Account.Value
}
if req.AreaCode != nil {
update["area_code"] = req.AreaCode.Value
}
if req.Email != nil {
update["email"] = req.Email.Value
}
if req.Nickname != nil {
if req.Nickname.Value == "" {
return nil, errs.ErrArgs.WrapMsg("nickname can not be empty")
}
update["nickname"] = req.Nickname.Value
}
if req.FaceURL != nil {
update["face_url"] = req.FaceURL.Value
}
if req.Gender != nil {
update["gender"] = req.Gender.Value
}
if req.Level != nil {
update["level"] = req.Level.Value
}
if req.Birth != nil {
update["birth_time"] = time.UnixMilli(req.Birth.Value)
}
if req.AllowAddFriend != nil {
update["allow_add_friend"] = req.AllowAddFriend.Value
}
if req.AllowBeep != nil {
update["allow_beep"] = req.AllowBeep.Value
}
if req.AllowVibration != nil {
update["allow_vibration"] = req.AllowVibration.Value
}
if req.GlobalRecvMsgOpt != nil {
update["global_recv_msg_opt"] = req.GlobalRecvMsgOpt.Value
}
//if len(update) == 0 {
// return nil, errs.ErrArgs.WrapMsg("no update info")
//}
return update, nil
}

Screenshots Link

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions