Merge branch 'superGroup' of github.com:OpenIMSDK/Open-IM-Server into superGroup

pull/236/head
wangchuxiao 3 years ago
commit ed7d2bbdd7

@ -267,45 +267,3 @@ func GetOfflinePushOpts(pushMsg *pbPush.PushMsgReq) (opts push.PushOpts, err err
} }
return opts, nil return opts, nil
} }
//func SendMsgByWS(m *pbChat.WSToMsgSvrChatMsg) {
// m.MsgID = rpcChat.GetMsgID(m.SendID)
// m.ClientMsgID = m.MsgID
// switch m.SessionType {
// case constant.SingleChatType:
// sendMsgToKafka(m, m.SendID, "msgKey--sendID")
// sendMsgToKafka(m, m.RecvID, "msgKey--recvID")
// case constant.GroupChatType:
// etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
// client := pbGroup.NewGroupClient(etcdConn)
// req := &pbGroup.Req{
// GroupID: m.RecvID,
// Token: config.Config.Secret,
// OperationID: m.OperationID,
// }
// reply, err := client.(context.Background(), req)
// if err != nil {
// log.Error(m.Token, m.OperationID, "rpc getGroupInfo failed, err = %s", err.Error())
// return
// }
// if reply.ErrorCode != 0 {
// log.Error(m.Token, m.OperationID, "rpc getGroupInfo failed, err = %s", reply.ErrorMsg)
// return
// }
// groupID := m.RecvID
// for i, v := range reply.MemberList {
// m.RecvID = v.UserId + " " + groupID
// sendMsgToKafka(m, utils.IntToString(i), "msgKey--recvID+\" \"+groupID")
// }
// default:
//
// }
//}
//
//func sendMsgToKafka(m *pbChat.WSToMsgSvrChatMsg, key string, flag string) {
// pid, offset, err := producer.SendMessage(m, key)
// if err != nil {
// log.ErrorByKv("kafka send failed", m.OperationID, "send data", m.String(), "pid", pid, "offset", offset, "err", err.Error(), flag, key)
// }
//
//}

@ -200,9 +200,7 @@ 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 {
for _, userID := range okUserIDList { chat.SuperGroupNotification(req.OperationID, req.OpUserID, groupId)
chat.SuperGroupNotification(req.OperationID, req.OpUserID, userID)
}
} }
return resp, nil return resp, nil
@ -385,9 +383,7 @@ 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 {
for _, userID := range okUserIDList { chat.SuperGroupNotification(req.OperationID, req.OpUserID, req.GroupID)
chat.SuperGroupNotification(req.OperationID, req.OpUserID, userID)
}
} }
log.NewInfo(req.OperationID, "InviteUserToGroup rpc return ") log.NewInfo(req.OperationID, "InviteUserToGroup rpc return ")
@ -589,9 +585,7 @@ 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 {
for _, userID := range okUserIDList { chat.SuperGroupNotification(req.OperationID, req.OpUserID, req.GroupID)
chat.SuperGroupNotification(req.OperationID, req.OpUserID, userID)
}
} }
log.NewInfo(req.OperationID, "GetGroupMemberList rpc return ", resp.String()) log.NewInfo(req.OperationID, "GetGroupMemberList rpc return ", resp.String())
return &resp, nil return &resp, nil

@ -514,7 +514,7 @@ func Notification(n *NotificationMsg) {
msg.ClientMsgID = utils.GetMsgID(n.SendID) msg.ClientMsgID = utils.GetMsgID(n.SendID)
msg.Options = make(map[string]bool, 7) msg.Options = make(map[string]bool, 7)
switch n.SessionType { switch n.SessionType {
case constant.GroupChatType: case constant.GroupChatType, constant.SuperGroupChatType:
msg.RecvID = "" msg.RecvID = ""
msg.GroupID = n.RecvID msg.GroupID = n.RecvID
} }
@ -735,6 +735,8 @@ func Notification(n *NotificationMsg) {
unReadCount = config.Config.Notification.ConversationSetPrivate.Conversation.UnreadCount unReadCount = config.Config.Notification.ConversationSetPrivate.Conversation.UnreadCount
case constant.DeleteMessageNotification: case constant.DeleteMessageNotification:
reliabilityLevel = constant.ReliableNotificationNoMsg reliabilityLevel = constant.ReliableNotificationNoMsg
case constant.SuperGroupUpdateNotification:
reliabilityLevel = constant.UnreliableNotification
} }
switch reliabilityLevel { switch reliabilityLevel {
case constant.UnreliableNotification: case constant.UnreliableNotification:

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

File diff suppressed because it is too large Load Diff

@ -238,6 +238,7 @@ message MsgData {
map<string, bool> options = 18; map<string, bool> options = 18;
OfflinePushInfo offlinePushInfo = 19; OfflinePushInfo offlinePushInfo = 19;
repeated string atUserIDList = 20; repeated string atUserIDList = 20;
repeated MsgData msgDataList = 21;
} }
message OfflinePushInfo{ message OfflinePushInfo{

Loading…
Cancel
Save