diff --git a/internal/api/user/user.go b/internal/api/user/user.go index 3ddc95353..9ebc46a26 100644 --- a/internal/api/user/user.go +++ b/internal/api/user/user.go @@ -6,6 +6,7 @@ import ( "Open_IM/pkg/common/log" "Open_IM/pkg/common/token_verify" "Open_IM/pkg/grpc-etcdv3/getcdv3" + open_im_sdk "Open_IM/pkg/proto/sdk_ws" rpc "Open_IM/pkg/proto/user" "Open_IM/pkg/utils" "context" @@ -115,8 +116,8 @@ func UpdateUserInfo(c *gin.Context) { c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) return } - req := &rpc.UpdateUserInfoReq{} - utils.CopyStructFields(req, ¶ms) + req := &rpc.UpdateUserInfoReq{UserInfo: &open_im_sdk.UserInfo{}} + utils.CopyStructFields(req.UserInfo, ¶ms) var ok bool ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token")) if !ok { diff --git a/pkg/base_info/public_struct.go b/pkg/base_info/public_struct.go index 679b58082..1becfe0ab 100644 --- a/pkg/base_info/public_struct.go +++ b/pkg/base_info/public_struct.go @@ -7,7 +7,7 @@ import ( type UserInfo struct { UserID string `json:"userID" binding:"required,min=1,max=64"` - Nickname string `json:"nickname" binding:"required,min=1,max=64"` + Nickname string `json:"nickname" binding:"omitempty,min=1,max=64"` FaceUrl string `json:"faceUrl" binding:"omitempty,max=1024"` Gender int32 `json:"gender" binding:"omitempty,oneof=0 1 2"` PhoneNumber string `json:"phoneNumber" binding:"omitempty,max=32"`