Refactor code

pull/141/head
wenxu12345 3 years ago
parent 72f87b449b
commit 3a2cd0276a

@ -54,12 +54,19 @@ func setGroupInfo(groupID string, groupInfo *open_im_sdk.GroupInfo) error {
func setGroupMemberInfo(groupID, userID string, groupMemberInfo *open_im_sdk.GroupMemberFullInfo) error {
groupMember, err := imdb.GetGroupMemberInfoByGroupIDAndUserID(groupID, userID)
if err != nil {
return utils.Wrap(err, "")
if err == nil {
return utils.Wrap(utils2.GroupMemberDBCopyOpenIM(groupMemberInfo, groupMember), "")
}
if err = utils2.GroupMemberDBCopyOpenIM(groupMemberInfo, groupMember); err != nil {
user, err := imdb.GetUserByUserID(userID)
if err != nil {
return utils.Wrap(err, "")
}
groupMemberInfo.GroupID = groupID
groupMemberInfo.UserID = user.UserID
groupMemberInfo.Nickname = user.Nickname
groupMemberInfo.AppMangerLevel = user.AppMangerLevel
groupMemberInfo.FaceURL = user.FaceURL
return nil
}

@ -64,9 +64,9 @@ func RegisterEtcd(schema, etcdAddr, myHost string, myPort int, serviceName strin
//keepalive
kresp, err := cli.KeepAlive(ctx, resp.ID)
if err != nil {
return fmt.Errorf("keepalive faild, errmsg:%v, lease id:%d", err, resp.ID)
return fmt.Errorf("keepalive failed, errmsg:%v, lease id:%d", err, resp.ID)
}
fmt.Println("RegisterEtcd ok")
go func() {
FLOOP:
for {

Loading…
Cancel
Save