super group notification

This commit is contained in:
wenxu12345 2022-06-21 14:54:42 +08:00
parent b242aac7cd
commit 49797ce6ab
2 changed files with 20 additions and 8 deletions

View File

@ -208,8 +208,11 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR
if req.GroupInfo.GroupType != constant.SuperGroup { if req.GroupInfo.GroupType != constant.SuperGroup {
chat.GroupCreatedNotification(req.OperationID, req.OpUserID, groupId, okUserIDList) chat.GroupCreatedNotification(req.OperationID, req.OpUserID, groupId, okUserIDList)
} else { } else {
chat.SuperGroupNotification(req.OperationID, req.OpUserID, groupId) go func() {
for _, v := range okUserIDList {
chat.SuperGroupNotification(req.OperationID, v, v)
}
}()
} }
return resp, nil return resp, nil
} else { } else {
@ -406,7 +409,11 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite
if groupInfo.GroupType != constant.SuperGroup { if groupInfo.GroupType != constant.SuperGroup {
chat.MemberInvitedNotification(req.OperationID, req.GroupID, req.OpUserID, req.Reason, okUserIDList) chat.MemberInvitedNotification(req.OperationID, req.GroupID, req.OpUserID, req.Reason, okUserIDList)
} else { } else {
chat.SuperGroupNotification(req.OperationID, req.OpUserID, req.GroupID) go func() {
for _, v := range req.InvitedUserIDList {
chat.SuperGroupNotification(req.OperationID, v, v)
}
}()
} }
log.NewInfo(req.OperationID, "InviteUserToGroup rpc return ") log.NewInfo(req.OperationID, "InviteUserToGroup rpc return ")
@ -620,7 +627,12 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGrou
if groupInfo.GroupType != constant.SuperGroup { if groupInfo.GroupType != constant.SuperGroup {
chat.MemberKickedNotification(req, okUserIDList) chat.MemberKickedNotification(req, okUserIDList)
} else { } else {
chat.SuperGroupNotification(req.OperationID, req.OpUserID, req.GroupID) go func() {
for _, v := range req.KickedUserIDList {
chat.SuperGroupNotification(req.OperationID, v, v)
}
}()
} }
log.NewInfo(req.OperationID, "GetGroupMemberList rpc return ", resp.String()) log.NewInfo(req.OperationID, "GetGroupMemberList rpc return ", resp.String())
return &resp, nil return &resp, nil
@ -928,7 +940,7 @@ func (s *groupServer) QuitGroup(ctx context.Context, req *pbGroup.QuitGroupReq)
if groupInfo.GroupType != constant.SuperGroup { if groupInfo.GroupType != constant.SuperGroup {
chat.MemberQuitNotification(req) chat.MemberQuitNotification(req)
} else { } else {
chat.SuperGroupNotification(req.OperationID, req.OpUserID, req.GroupID) chat.SuperGroupNotification(req.OperationID, req.OpUserID, req.OpUserID)
} }
log.NewInfo(req.OperationID, "rpc QuitGroup return ", pbGroup.QuitGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: 0, ErrMsg: ""}}) log.NewInfo(req.OperationID, "rpc QuitGroup return ", pbGroup.QuitGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: 0, ErrMsg: ""}})

View File

@ -9,7 +9,7 @@ import (
//"github.com/golang/protobuf/proto" //"github.com/golang/protobuf/proto"
) )
func SuperGroupNotification(operationID, sendID, groupID string) { func SuperGroupNotification(operationID, sendID, recvID string) {
//var tips sdk.TipsComm //var tips sdk.TipsComm
//var err error //var err error
@ -21,10 +21,10 @@ func SuperGroupNotification(operationID, sendID, groupID string) {
//tips.JsonDetail, _ = marshaler.MarshalToString(m) //tips.JsonDetail, _ = marshaler.MarshalToString(m)
n := &NotificationMsg{ n := &NotificationMsg{
SendID: sendID, SendID: sendID,
RecvID: groupID, RecvID: recvID,
MsgFrom: constant.SysMsgType, MsgFrom: constant.SysMsgType,
ContentType: constant.SuperGroupUpdateNotification, ContentType: constant.SuperGroupUpdateNotification,
SessionType: constant.SuperGroupChatType, SessionType: constant.SingleChatType,
OperationID: operationID, OperationID: operationID,
} }
//n.Content, err = proto.Marshal(&tips) //n.Content, err = proto.Marshal(&tips)