mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
fix bug
This commit is contained in:
parent
7bbf2b200b
commit
20851f2a96
@ -15,7 +15,6 @@ import (
|
||||
"Open_IM/pkg/utils"
|
||||
"context"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/golang/protobuf/ptypes/wrappers"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
@ -216,9 +215,6 @@ func UpdateUserInfo(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
log.NewInfo(params.OperationID, "UpdateUserInfo args ", req.String())
|
||||
if params.GlobalRecvMsgOpt != nil {
|
||||
req.GlobalRecvMsgOpt = &wrappers.Int32Value{Value: *params.GlobalRecvMsgOpt}
|
||||
}
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
|
@ -383,26 +383,11 @@ func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbUser.UpdateUserI
|
||||
if req.UserInfo.Birth != 0 {
|
||||
user.Birth = utils.UnixSecondToTime(int64(req.UserInfo.Birth))
|
||||
}
|
||||
m := make(map[string]interface{}, 1)
|
||||
if req.GlobalRecvMsgOpt != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), req.GlobalRecvMsgOpt, "set GlobalRecvMsgOpt")
|
||||
m["global_recv_msg_opt"] = req.GlobalRecvMsgOpt.Value
|
||||
err := db.DB.SetUserGlobalMsgRecvOpt(user.UserID, req.GlobalRecvMsgOpt.Value)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "SetUserGlobalMsgRecvOpt failed ", err.Error(), user)
|
||||
return &pbUser.UpdateUserInfoResp{CommonResp: &pbUser.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil
|
||||
}
|
||||
err = imdb.UpdateUserInfoByMap(user, m)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "UpdateUserInfo failed ", err.Error(), user)
|
||||
return &pbUser.UpdateUserInfoResp{CommonResp: &pbUser.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil
|
||||
}
|
||||
} else {
|
||||
err := imdb.UpdateUserInfo(user)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "UpdateUserInfo failed ", err.Error(), user)
|
||||
return &pbUser.UpdateUserInfoResp{CommonResp: &pbUser.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil
|
||||
}
|
||||
|
||||
err := imdb.UpdateUserInfo(user)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "UpdateUserInfo failed ", err.Error(), user)
|
||||
return &pbUser.UpdateUserInfoResp{CommonResp: &pbUser.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil
|
||||
}
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
|
@ -6,15 +6,14 @@ import (
|
||||
)
|
||||
|
||||
type ApiUserInfo struct {
|
||||
UserID string `json:"userID" 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"`
|
||||
Birth uint32 `json:"birth" binding:"omitempty"`
|
||||
Email string `json:"email" binding:"omitempty,max=64"`
|
||||
GlobalRecvMsgOpt *int32 `json:"globalRecvMsgOpt" binding:"omitempty,oneof=0 1 2"`
|
||||
Ex string `json:"ex" binding:"omitempty,max=1024"`
|
||||
UserID string `json:"userID" 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"`
|
||||
Birth uint32 `json:"birth" binding:"omitempty"`
|
||||
Email string `json:"email" binding:"omitempty,max=64"`
|
||||
Ex string `json:"ex" binding:"omitempty,max=1024"`
|
||||
}
|
||||
|
||||
//type Conversation struct {
|
||||
|
Loading…
x
Reference in New Issue
Block a user