Merge remote-tracking branch 'origin/v2.3.0release' into v2.3.0release

# Conflicts:
#	pkg/base_info/group_api_struct.go
This commit is contained in:
skiffer-git
2022-08-05 13:40:57 +08:00
16 changed files with 420 additions and 254 deletions
+1 -1
View File
@@ -239,7 +239,7 @@ func GetGroupAllMemberList(c *gin.Context) {
memberListResp := api.GetGroupAllMemberResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, MemberList: RpcResp.MemberList}
memberListResp.Data = jsonData.JsonDataList(memberListResp.MemberList)
log.NewInfo(req.OperationID, "GetGroupAllMember api return ", memberListResp)
log.NewInfo(req.OperationID, "GetGroupAllMember api return ", len(memberListResp.MemberList))
c.JSON(http.StatusOK, memberListResp)
}
+2 -2
View File
@@ -196,7 +196,7 @@ func (ws *WServer) MultiTerminalLoginChecker(uid string, platformID int, newConn
if oldConnMap, ok := ws.wsUserToConn[uid]; ok { // user->map[platform->conn]
if oldConn, ok := oldConnMap[platformID]; ok {
log.NewDebug(operationID, uid, platformID, "kick old conn")
// ws.sendKickMsg(oldConn, newConn)
ws.sendKickMsg(oldConn, newConn)
m, err := db.DB.GetTokenMapByUidPid(uid, constant.PlatformIDToName(platformID))
if err != nil && err != go_redis.Nil {
log.NewError(operationID, "get token from redis err", err.Error(), uid, constant.PlatformIDToName(platformID))
@@ -230,7 +230,7 @@ func (ws *WServer) MultiTerminalLoginChecker(uid string, platformID int, newConn
log.NewError(operationID, "conn close err", err.Error(), uid, platformID)
}
} else {
log.NewWarn(operationID, "abnormal uid-conn ", uid, platformID, oldConnMap[platformID])
log.NewWarn(operationID, "normal uid-conn ", uid, platformID, oldConnMap[platformID])
}
} else {
+4 -3
View File
@@ -2,6 +2,7 @@ package logic
import (
cbApi "Open_IM/pkg/call_back_struct"
"Open_IM/pkg/common/callback"
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/http"
@@ -32,7 +33,7 @@ func callbackOfflinePush(operationID string, userIDList []string, msg *commonPb.
ContentType: msg.ContentType,
SessionType: msg.SessionType,
AtUserIDList: msg.AtUserIDList,
Content: string(msg.Content),
Content: callback.GetContent(msg),
}
resp := &cbApi.CallbackBeforePushResp{CommonCallbackResp: &callbackResp}
if err := http.PostReturn(config.Config.Callback.CallbackUrl, req, resp, config.Config.Callback.CallbackOfflinePush.CallbackTimeOut); err != nil {
@@ -74,7 +75,7 @@ func callbackOnlinePush(operationID string, userIDList []string, msg *commonPb.M
ContentType: msg.ContentType,
SessionType: msg.SessionType,
AtUserIDList: msg.AtUserIDList,
Content: string(msg.Content),
Content: callback.GetContent(msg),
}
resp := &cbApi.CallbackBeforePushResp{CommonCallbackResp: &callbackResp}
if err := http.PostReturn(config.Config.Callback.CallbackUrl, req, resp, config.Config.Callback.CallbackOnlinePush.CallbackTimeOut); err != nil {
@@ -110,7 +111,7 @@ func callbackBeforeSuperGroupOnlinePush(operationID string, groupID string, msg
ContentType: msg.ContentType,
SessionType: msg.SessionType,
AtUserIDList: msg.AtUserIDList,
Content: string(msg.Content),
Content: callback.GetContent(msg),
}
resp := &cbApi.CallbackBeforeSuperGroupOnlinePushResp{CommonCallbackResp: &callbackResp}
if err := http.PostReturn(config.Config.Callback.CallbackUrl, req, resp, config.Config.Callback.CallbackBeforeSuperGroupOnlinePush.CallbackTimeOut); err != nil {
+11 -4
View File
@@ -30,6 +30,7 @@ func (rpc *rpcConversation) ModifyConversationField(c context.Context, req *pbCo
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String())
resp := &pbConversation.ModifyConversationFieldResp{}
var err error
isSyncConversation := true
if req.Conversation.ConversationType == constant.GroupChatType {
groupInfo, err := imdb.GetGroupInfoByGroupID(req.Conversation.GroupID)
if err != nil {
@@ -71,8 +72,7 @@ func (rpc *rpcConversation) ModifyConversationField(c context.Context, req *pbCo
case constant.FieldAttachedInfo:
err = imdb.UpdateColumnsConversations(haveUserID, req.Conversation.ConversationID, map[string]interface{}{"attached_info": conversation.AttachedInfo})
case constant.FieldUnread:
err = imdb.UpdateColumnsConversations(haveUserID, req.Conversation.ConversationID, map[string]interface{}{"unread_count": conversation.UnreadCount})
isSyncConversation = false
}
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), "UpdateColumnsConversations error", err.Error())
@@ -97,9 +97,16 @@ func (rpc *rpcConversation) ModifyConversationField(c context.Context, req *pbCo
return resp, nil
}
} else {
for _, v := range req.UserIDList {
chat.ConversationChangeNotification(req.OperationID, v)
if isSyncConversation {
for _, v := range req.UserIDList {
chat.ConversationChangeNotification(req.OperationID, v)
}
} else {
for _, v := range req.UserIDList {
chat.ConversationUnreadChangeNotification(req.OperationID, v, req.Conversation.ConversationID)
}
}
}
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc return", resp.String())
resp.CommonResp = &pbConversation.CommonResp{}
+92 -53
View File
@@ -467,9 +467,7 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), userID)
}
}
if err := rocksCache.DelAllGroupMembersInfoFromCache(req.GroupID); err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.GroupID)
}
chat.MemberInvitedNotification(req.OperationID, req.GroupID, req.OpUserID, req.Reason, okUserIDList)
} else {
for _, v := range req.InvitedUserIDList {
@@ -491,7 +489,6 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite
func (s *groupServer) GetGroupAllMember(ctx context.Context, req *pbGroup.GetGroupAllMemberReq) (*pbGroup.GetGroupAllMemberResp, error) {
log.NewInfo(req.OperationID, "GetGroupAllMember, args ", req.String())
var resp pbGroup.GetGroupAllMemberResp
//groupInfo, err := imdb.GetGroupInfoByGroupID(req.GroupID)
groupInfo, err := rocksCache.GetGroupInfoFromCache(req.GroupID)
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.GroupID)
@@ -500,7 +497,7 @@ func (s *groupServer) GetGroupAllMember(ctx context.Context, req *pbGroup.GetGro
return &resp, nil
}
if groupInfo.GroupType != constant.SuperGroup {
memberList, err := rocksCache.GetAllGroupMembersInfoFromCache(req.GroupID)
memberList, err := rocksCache.GetGroupMembersInfoFromCache(req.Count, req.Offset, req.GroupID)
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.GroupID)
resp.ErrCode = constant.ErrDB.ErrCode
@@ -513,7 +510,7 @@ func (s *groupServer) GetGroupAllMember(ctx context.Context, req *pbGroup.GetGro
resp.MemberList = append(resp.MemberList, &node)
}
}
log.NewInfo(req.OperationID, "GetGroupAllMember rpc return ", resp.String())
log.NewInfo(req.OperationID, "GetGroupAllMember rpc return ", len(resp.MemberList))
return &resp, nil
}
@@ -693,10 +690,11 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGrou
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), userID)
}
if err := rocksCache.DelGroupMemberInfoFromCache(req.GroupID, userID); err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.GroupID)
}
}
if err := rocksCache.DelAllGroupMembersInfoFromCache(req.GroupID); err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.GroupID)
}
chat.MemberKickedNotification(req, okUserIDList)
} else {
for _, userID := range okUserIDList {
@@ -721,22 +719,35 @@ func (s *groupServer) GetGroupMembersInfo(ctx context.Context, req *pbGroup.GetG
log.NewInfo(req.OperationID, "GetGroupMembersInfo args ", req.String())
var resp pbGroup.GetGroupMembersInfoResp
resp.MemberList = []*open_im_sdk.GroupMemberFullInfo{}
groupMembers, err := rocksCache.GetAllGroupMembersInfoFromCache(req.GroupID)
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), req.GroupID, err.Error())
resp.ErrCode = constant.ErrDB.ErrCode
resp.ErrMsg = constant.ErrDB.ErrMsg
return &resp, nil
}
for _, member := range groupMembers {
if utils.IsContain(member.UserID, req.MemberList) {
var memberNode open_im_sdk.GroupMemberFullInfo
utils.CopyStructFields(&memberNode, member)
memberNode.JoinTime = int32(member.JoinTime.Unix())
resp.MemberList = append(resp.MemberList, &memberNode)
for _, userID := range req.MemberList {
groupMember, err := rocksCache.GetGroupMemberInfoFromCache(req.GroupID, userID)
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), req.GroupID, userID, err.Error())
continue
}
var memberNode open_im_sdk.GroupMemberFullInfo
utils.CopyStructFields(&memberNode, groupMember)
memberNode.JoinTime = int32(groupMember.JoinTime.Unix())
resp.MemberList = append(resp.MemberList, &memberNode)
}
//groupMembers, err := rocksCache.GetAllGroupMembersInfoFromCache(req.GroupID)
//if err != nil {
// log.NewError(req.OperationID, utils.GetSelfFuncName(), req.GroupID, err.Error())
// resp.ErrCode = constant.ErrDB.ErrCode
// resp.ErrMsg = constant.ErrDB.ErrMsg
// return &resp, nil
//}
//for _, member := range groupMembers {
// if utils.IsContain(member.UserID, req.MemberList) {
// var memberNode open_im_sdk.GroupMemberFullInfo
// utils.CopyStructFields(&memberNode, member)
// memberNode.JoinTime = int32(member.JoinTime.Unix())
// resp.MemberList = append(resp.MemberList, &memberNode)
// }
//}
resp.ErrCode = 0
log.NewInfo(req.OperationID, "GetGroupMembersInfo rpc return ", resp.String())
return &resp, nil
@@ -899,17 +910,17 @@ func (s *groupServer) GroupApplicationResponse(_ context.Context, req *pbGroup.G
return &pbGroup.GroupApplicationResponseResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil
}
group, err := rocksCache.GetGroupInfoFromCache(req.GroupID)
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), req.GroupID, err.Error())
}
if group != nil {
if group.GroupType != constant.SuperGroup {
if err := rocksCache.DelAllGroupMembersInfoFromCache(req.GroupID); err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.GroupID)
}
}
}
//group, err := rocksCache.GetGroupInfoFromCache(req.GroupID)
//if err != nil {
// log.NewError(req.OperationID, utils.GetSelfFuncName(), req.GroupID, err.Error())
//}
//if group != nil {
// if group.GroupType != constant.SuperGroup {
// if err := rocksCache.DelAllGroupMembersInfoFromCache(req.GroupID); err != nil {
// log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.GroupID)
// }
// }
//}
chat.GroupApplicationAcceptedNotification(req)
chat.MemberEnterNotification(req)
@@ -987,10 +998,10 @@ func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq)
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error())
}
err = rocksCache.DelAllGroupMembersInfoFromCache(req.GroupID)
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error())
}
//err = rocksCache.DelAllGroupMembersInfoFromCache(req.GroupID)
//if err != nil {
// log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error())
//}
chat.MemberEnterDirectlyNotification(req.GroupID, req.OpUserID, req.OperationID)
log.NewInfo(req.OperationID, "JoinGroup rpc return ")
@@ -1100,7 +1111,10 @@ func (s *groupServer) QuitGroup(ctx context.Context, req *pbGroup.QuitGroupReq)
}
if groupInfo.GroupType != constant.SuperGroup {
if err := rocksCache.DelAllGroupMembersInfoFromCache(req.GroupID); err != nil {
//if err := rocksCache.DelAllGroupMembersInfoFromCache(req.GroupID); err != nil {
// log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.GroupID)
//}
if err := rocksCache.DelGroupMemberInfoFromCache(req.GroupID, req.OpUserID); err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.GroupID)
}
if err := rocksCache.DelJoinedGroupIDListFromCache(req.OpUserID); err != nil {
@@ -1304,8 +1318,16 @@ func (s *groupServer) TransferGroupOwner(_ context.Context, req *pbGroup.Transfe
log.NewError(req.OperationID, "UpdateGroupMemberInfo failed ", groupMemberInfo)
return &pbGroup.TransferGroupOwnerResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil
}
if err := rocksCache.DelAllGroupMembersInfoFromCache(req.GroupID); err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), req.GroupID, err.Error())
//if err := rocksCache.DelAllGroupMembersInfoFromCache(req.GroupID); err != nil {
// log.NewError(req.OperationID, utils.GetSelfFuncName(), req.GroupID, err.Error())
//}
err = rocksCache.DelGroupMemberInfoFromCache(req.GroupID, req.NewOwnerUserID)
if err != nil {
log.NewError(req.OperationID, "DelGroupMemberInfoFromCache failed ", req.GroupID, req.NewOwnerUserID)
}
err = rocksCache.DelGroupMemberInfoFromCache(req.GroupID, req.OldOwnerUserID)
if err != nil {
log.NewError(req.OperationID, "DelGroupMemberInfoFromCache failed ", req.GroupID, req.OldOwnerUserID)
}
chat.GroupOwnerTransferredNotification(req)
return &pbGroup.TransferGroupOwnerResp{CommonResp: &pbGroup.CommonResp{ErrCode: 0, ErrMsg: ""}}, nil
@@ -1581,8 +1603,13 @@ func (s *groupServer) RemoveGroupMembersCMS(_ context.Context, req *pbGroup.Remo
log.NewError(req.OperationID, "DelGroupMemberIDListFromCache rpc logic call failed ", cacheResp.String())
return resp, http.WrapError(constant.ErrDB)
}
if err := rocksCache.DelAllGroupMembersInfoFromCache(req.GroupId); err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.GroupId)
//if err := rocksCache.DelAllGroupMembersInfoFromCache(req.GroupId); err != nil {
// log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.GroupId)
//}
for _, userID := range resp.Success {
if err := rocksCache.DelGroupMemberInfoFromCache(req.GroupId, userID); err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.GroupId, userID)
}
}
chat.MemberKickedNotification(reqKick, resp.Success)
@@ -1643,9 +1670,9 @@ func (s *groupServer) AddGroupMembersCMS(_ context.Context, req *pbGroup.AddGrou
log.NewError(req.OperationId, "DelGroupMemberIDListFromCache rpc logic call failed ", cacheResp.String())
return resp, http.WrapError(constant.ErrDB)
}
if err := rocksCache.DelAllGroupMembersInfoFromCache(req.GroupId); err != nil {
log.NewError(req.OperationId, utils.GetSelfFuncName(), err.Error(), req.GroupId)
}
//if err := rocksCache.DelAllGroupMembersInfoFromCache(req.GroupId); err != nil {
// log.NewError(req.OperationId, utils.GetSelfFuncName(), err.Error(), req.GroupId)
//}
chat.MemberInvitedNotification(req.OperationId, req.GroupId, req.OpUserId, "admin add you to group", resp.Success)
return resp, nil
@@ -1767,9 +1794,9 @@ func (s *groupServer) DismissGroup(ctx context.Context, req *pbGroup.DismissGrou
log.NewError(req.OperationID, "DelGroupMemberIDListFromCache rpc logic call failed ", cacheResp.String())
return &pbGroup.DismissGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: cacheResp.CommonResp.ErrCode, ErrMsg: cacheResp.CommonResp.ErrMsg}}, nil
}
if err := rocksCache.DelAllGroupMembersInfoFromCache(req.GroupID); err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.GroupID)
}
//if err := rocksCache.DelAllGroupMembersInfoFromCache(req.GroupID); err != nil {
// log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.GroupID)
//}
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc return ", pbGroup.CommonResp{ErrCode: 0, ErrMsg: ""})
return &pbGroup.DismissGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: 0, ErrMsg: ""}}, nil
}
@@ -1815,7 +1842,10 @@ func (s *groupServer) MuteGroupMember(ctx context.Context, req *pbGroup.MuteGrou
log.Error(req.OperationID, "UpdateGroupMemberInfo failed ", err.Error(), groupMemberInfo)
return &pbGroup.MuteGroupMemberResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil
}
if err := rocksCache.DelAllGroupMembersInfoFromCache(req.GroupID); err != nil {
//if err := rocksCache.DelAllGroupMembersInfoFromCache(req.GroupID); err != nil {
// log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.GroupID)
//}
if err := rocksCache.DelGroupMemberInfoFromCache(req.GroupID, req.UserID); err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.GroupID)
}
chat.GroupMemberMutedNotification(req.OperationID, req.OpUserID, req.GroupID, req.UserID, req.MutedSeconds)
@@ -1859,7 +1889,10 @@ func (s *groupServer) CancelMuteGroupMember(ctx context.Context, req *pbGroup.Ca
log.Error(req.OperationID, "UpdateGroupMemberInfo failed ", err.Error(), groupMemberInfo)
return &pbGroup.CancelMuteGroupMemberResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil
}
if err := rocksCache.DelAllGroupMembersInfoFromCache(req.GroupID); err != nil {
//if err := rocksCache.DelAllGroupMembersInfoFromCache(req.GroupID); err != nil {
// log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.GroupID)
//}
if err := rocksCache.DelGroupMemberInfoFromCache(req.GroupID, req.UserID); err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.GroupID)
}
chat.GroupMemberCancelMutedNotification(req.OperationID, req.OpUserID, req.GroupID, req.UserID)
@@ -1979,7 +2012,10 @@ func (s *groupServer) SetGroupMemberNickname(ctx context.Context, req *pbGroup.S
log.Error(req.OperationID, errMsg)
return &pbGroup.SetGroupMemberNicknameResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil
}
if err := rocksCache.DelAllGroupMembersInfoFromCache(req.GroupID); err != nil {
//if err := rocksCache.DelAllGroupMembersInfoFromCache(req.GroupID); err != nil {
// log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.GroupID)
//}
if err := rocksCache.DelGroupMemberInfoFromCache(req.GroupID, req.UserID); err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.GroupID)
}
chat.GroupMemberInfoSetNotification(req.OperationID, req.OpUserID, req.GroupID, req.UserID)
@@ -2014,8 +2050,11 @@ func (s *groupServer) SetGroupMemberInfo(ctx context.Context, req *pbGroup.SetGr
resp.CommonResp.ErrMsg = constant.ErrDB.ErrMsg + ":" + err.Error()
return resp, nil
}
if err := rocksCache.DelAllGroupMembersInfoFromCache(req.GroupID); err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.GroupID)
//if err := rocksCache.DelAllGroupMembersInfoFromCache(req.GroupID); err != nil {
// log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.GroupID)
//}
if err := rocksCache.DelGroupMemberInfoFromCache(req.GroupID, req.UserID); err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.GroupID, req.UserID)
}
if req.RoleLevel != nil {
switch req.RoleLevel.Value {
+4 -2
View File
@@ -2,6 +2,7 @@ package msg
import (
cbApi "Open_IM/pkg/call_back_struct"
"Open_IM/pkg/common/callback"
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/http"
@@ -12,7 +13,7 @@ import (
)
func copyCallbackCommonReqStruct(msg *pbChat.SendMsgReq) cbApi.CommonCallbackReq {
return cbApi.CommonCallbackReq{
req := cbApi.CommonCallbackReq{
SendID: msg.MsgData.SendID,
ServerMsgID: msg.MsgData.ServerMsgID,
ClientMsgID: msg.MsgData.ClientMsgID,
@@ -24,10 +25,11 @@ func copyCallbackCommonReqStruct(msg *pbChat.SendMsgReq) cbApi.CommonCallbackReq
ContentType: msg.MsgData.ContentType,
Status: msg.MsgData.Status,
CreateTime: msg.MsgData.CreateTime,
Content: string(msg.MsgData.Content),
AtUserIDList: msg.MsgData.AtUserIDList,
SenderFaceURL: msg.MsgData.SenderFaceURL,
Content: callback.GetContent(msg.MsgData),
}
return req
}
func callbackBeforeSendSingleMsg(msg *pbChat.SendMsgReq) cbApi.CommonCallbackResp {
@@ -68,3 +68,15 @@ func ConversationChangeNotification(operationID, userID string) {
tips.DefaultTips = config.Config.Notification.ConversationOptUpdate.DefaultTips.Tips
SetConversationNotification(operationID, userID, userID, constant.ConversationOptChangeNotification, ConversationChangedTips, tips)
}
//会话未读数同步
func ConversationUnreadChangeNotification(operationID, userID, conversationID string) {
log.NewInfo(operationID, utils.GetSelfFuncName())
ConversationChangedTips := &open_im_sdk.ConversationUpdateTips{
UserID: userID,
ConversationIDList: []string{conversationID},
}
var tips open_im_sdk.TipsComm
tips.DefaultTips = config.Config.Notification.ConversationOptUpdate.DefaultTips.Tips
SetConversationNotification(operationID, userID, userID, constant.ConversationUnreadNotification, ConversationChangedTips, tips)
}
+1 -1
View File
@@ -831,7 +831,7 @@ func Notification(n *NotificationMsg) {
unReadCount = config.Config.Notification.ConversationSetPrivate.Conversation.UnreadCount
case constant.DeleteMessageNotification:
reliabilityLevel = constant.ReliableNotificationNoMsg
case constant.SuperGroupUpdateNotification:
case constant.SuperGroupUpdateNotification, constant.ConversationUnreadNotification:
reliabilityLevel = constant.UnreliableNotification
}
switch reliabilityLevel {
+11 -4
View File
@@ -482,8 +482,12 @@ func (s *userServer) SyncJoinedGroupMemberFaceURL(userID string, faceURL string,
log.NewError(operationID, utils.GetSelfFuncName(), err.Error(), groupMemberInfo)
continue
}
if err := rocksCache.DelAllGroupMembersInfoFromCache(groupID); err != nil {
log.NewError(operationID, utils.GetSelfFuncName(), err.Error(), groupID)
//if err := rocksCache.DelAllGroupMembersInfoFromCache(groupID); err != nil {
// log.NewError(operationID, utils.GetSelfFuncName(), err.Error(), groupID)
// continue
//}
if err := rocksCache.DelGroupMemberInfoFromCache(groupID, userID); err != nil {
log.NewError(operationID, utils.GetSelfFuncName(), err.Error(), groupID, userID)
continue
}
chat.GroupMemberInfoSetNotification(operationID, opUserID, groupID, userID)
@@ -508,9 +512,12 @@ func (s *userServer) SyncJoinedGroupMemberNickname(userID string, newNickname, o
log.NewError(operationID, utils.GetSelfFuncName(), err.Error(), groupMemberInfo)
continue
}
if err := rocksCache.DelAllGroupMembersInfoFromCache(v); err != nil {
//if err := rocksCache.DelAllGroupMembersInfoFromCache(v); err != nil {
// log.NewError(operationID, utils.GetSelfFuncName(), err.Error(), v)
// continue
//}
if err := rocksCache.DelGroupMemberInfoFromCache(v, userID); err != nil {
log.NewError(operationID, utils.GetSelfFuncName(), err.Error(), v)
continue
}
chat.GroupMemberInfoSetNotification(operationID, opUserID, v, userID)
}