This commit is contained in:
withchao
2023-04-26 15:42:43 +08:00
parent cf39ea7364
commit f0a8b828be
4 changed files with 67 additions and 27 deletions
+3 -3
View File
@@ -24,7 +24,7 @@ func (c *ConversationNotificationSender) ConversationSetPrivateNotification(ctx
SendID: sendID,
IsPrivate: isPrivateChat,
}
return c.Notification(ctx, sendID, recvID, constant.ConversationPrivateChatNotification, constant.SingleChatType, tips)
return c.Notification(ctx, sendID, recvID, constant.ConversationPrivateChatNotification, tips)
}
// 会话改变
@@ -32,7 +32,7 @@ func (c *ConversationNotificationSender) ConversationChangeNotification(ctx cont
tips := &sdkws.ConversationUpdateTips{
UserID: userID,
}
return c.Notification(ctx, userID, userID, constant.ConversationChangeNotification, constant.SingleChatType, tips)
return c.Notification(ctx, userID, userID, constant.ConversationChangeNotification, tips)
}
// 会话未读数同步
@@ -42,5 +42,5 @@ func (c *ConversationNotificationSender) ConversationUnreadChangeNotification(ct
ConversationIDList: []string{conversationID},
UpdateUnreadCountTime: updateUnreadCountTime,
}
return c.Notification(ctx, userID, userID, constant.ConversationUnreadNotification, constant.SingleChatType, tips)
return c.Notification(ctx, userID, userID, constant.ConversationUnreadNotification, tips)
}
+10 -10
View File
@@ -92,7 +92,7 @@ func (f *FriendNotificationSender) getFromToUserNickname(ctx context.Context, fr
func (f *FriendNotificationSender) UserInfoUpdatedNotification(ctx context.Context, opUserID string, changedUserID string) error {
tips := sdkws.UserInfoUpdatedTips{UserID: changedUserID}
return f.Notification(ctx, opUserID, changedUserID, constant.SingleChatType, constant.UserInfoUpdatedNotification, &tips)
return f.Notification(ctx, opUserID, changedUserID, constant.UserInfoUpdatedNotification, &tips)
}
func (f *FriendNotificationSender) FriendApplicationAddNotification(ctx context.Context, req *pbFriend.ApplyToAddFriendReq) error {
@@ -100,7 +100,7 @@ func (f *FriendNotificationSender) FriendApplicationAddNotification(ctx context.
FromUserID: req.FromUserID,
ToUserID: req.ToUserID,
}}
return f.Notification(ctx, req.FromUserID, req.ToUserID, constant.SingleChatType, constant.FriendApplicationNotification, &tips)
return f.Notification(ctx, req.FromUserID, req.ToUserID, constant.FriendApplicationNotification, &tips)
}
func (c *FriendNotificationSender) FriendApplicationAgreedNotification(ctx context.Context, req *pbFriend.RespondFriendApplyReq) error {
@@ -108,7 +108,7 @@ func (c *FriendNotificationSender) FriendApplicationAgreedNotification(ctx conte
FromUserID: req.FromUserID,
ToUserID: req.ToUserID,
}, HandleMsg: req.HandleMsg}
return c.Notification(ctx, req.ToUserID, req.FromUserID, constant.SingleChatType, constant.FriendApplicationApprovedNotification, &tips)
return c.Notification(ctx, req.ToUserID, req.FromUserID, constant.FriendApplicationApprovedNotification, &tips)
}
func (c *FriendNotificationSender) FriendApplicationRefusedNotification(ctx context.Context, req *pbFriend.RespondFriendApplyReq) error {
@@ -116,7 +116,7 @@ func (c *FriendNotificationSender) FriendApplicationRefusedNotification(ctx cont
FromUserID: req.FromUserID,
ToUserID: req.ToUserID,
}, HandleMsg: req.HandleMsg}
return c.Notification(ctx, req.ToUserID, req.FromUserID, constant.SingleChatType, constant.FriendApplicationRejectedNotification, &tips)
return c.Notification(ctx, req.ToUserID, req.FromUserID, constant.FriendApplicationRejectedNotification, &tips)
}
func (c *FriendNotificationSender) FriendAddedNotification(ctx context.Context, operationID, opUserID, fromUserID, toUserID string) error {
@@ -137,7 +137,7 @@ func (c *FriendNotificationSender) FriendAddedNotification(ctx context.Context,
if err != nil {
return err
}
return c.Notification(ctx, fromUserID, toUserID, constant.SingleChatType, constant.FriendAddedNotification, &tips)
return c.Notification(ctx, fromUserID, toUserID, constant.FriendAddedNotification, &tips)
}
func (c *FriendNotificationSender) FriendDeletedNotification(ctx context.Context, req *pbFriend.DeleteFriendReq) error {
@@ -145,21 +145,21 @@ func (c *FriendNotificationSender) FriendDeletedNotification(ctx context.Context
FromUserID: req.OwnerUserID,
ToUserID: req.FriendUserID,
}}
return c.Notification(ctx, req.OwnerUserID, req.FriendUserID, constant.SingleChatType, constant.FriendDeletedNotification, &tips)
return c.Notification(ctx, req.OwnerUserID, req.FriendUserID, constant.FriendDeletedNotification, &tips)
}
func (c *FriendNotificationSender) FriendRemarkSetNotification(ctx context.Context, fromUserID, toUserID string) error {
tips := sdkws.FriendInfoChangedTips{FromToUserID: &sdkws.FromToUserID{}}
tips.FromToUserID.FromUserID = fromUserID
tips.FromToUserID.ToUserID = toUserID
return c.Notification(ctx, fromUserID, toUserID, constant.SingleChatType, constant.FriendRemarkSetNotification, &tips)
return c.Notification(ctx, fromUserID, toUserID, constant.FriendRemarkSetNotification, &tips)
}
func (c *FriendNotificationSender) BlackAddedNotification(ctx context.Context, req *pbFriend.AddBlackReq) error {
tips := sdkws.BlackAddedTips{FromToUserID: &sdkws.FromToUserID{}}
tips.FromToUserID.FromUserID = req.OwnerUserID
tips.FromToUserID.ToUserID = req.BlackUserID
return c.Notification(ctx, req.OwnerUserID, req.BlackUserID, constant.SingleChatType, constant.BlackAddedNotification, &tips)
return c.Notification(ctx, req.OwnerUserID, req.BlackUserID, constant.BlackAddedNotification, &tips)
}
func (c *FriendNotificationSender) BlackDeletedNotification(ctx context.Context, req *pbFriend.RemoveBlackReq) {
@@ -167,10 +167,10 @@ func (c *FriendNotificationSender) BlackDeletedNotification(ctx context.Context,
FromUserID: req.OwnerUserID,
ToUserID: req.BlackUserID,
}}
c.Notification(ctx, req.OwnerUserID, req.BlackUserID, constant.SingleChatType, constant.BlackDeletedNotification, &blackDeletedTips)
c.Notification(ctx, req.OwnerUserID, req.BlackUserID, constant.BlackDeletedNotification, &blackDeletedTips)
}
func (c *FriendNotificationSender) FriendInfoUpdatedNotification(ctx context.Context, changedUserID string, needNotifiedUserID string, opUserID string) {
tips := sdkws.UserInfoUpdatedTips{UserID: changedUserID}
c.Notification(ctx, opUserID, needNotifiedUserID, constant.SingleChatType, constant.FriendInfoUpdatedNotification, &tips)
c.Notification(ctx, opUserID, needNotifiedUserID, constant.FriendInfoUpdatedNotification, &tips)
}
+7 -8
View File
@@ -322,11 +322,11 @@ func (g *GroupNotificationSender) GroupInfoSetNotification(ctx context.Context,
if err != nil {
return err
}
groupInfoChangedTips := &sdkws.GroupInfoSetTips{Group: groupInfo.Group, OpUser: groupInfo.GroupOwnerUser}
tips := &sdkws.GroupInfoSetTips{Group: groupInfo.Group, OpUser: groupInfo.GroupOwnerUser}
if needVerification != nil {
groupInfoChangedTips.Group.NeedVerification = *needVerification
tips.Group.NeedVerification = *needVerification
}
return g.msgClient.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.GroupInfoSetNotification, constant.SuperGroupChatType, groupInfoChangedTips)
return g.msgClient.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.GroupInfoSetNotification, tips)
}
// ####################################
@@ -350,10 +350,9 @@ func (g *GroupNotificationSender) JoinGroupApplicationNotification(ctx context.C
if err != nil {
return err
}
joinGroupApplicationTips := &sdkws.JoinGroupApplicationTips{Group: group, Applicant: user, ReqMsg: req.ReqMessage}
tips := &sdkws.JoinGroupApplicationTips{Group: group, Applicant: user, ReqMsg: req.ReqMessage}
for _, userID := range userIDs {
err := g.groupNotification(ctx, constant.JoinGroupApplicationNotification, joinGroupApplicationTips, mcontext.GetOpUserID(ctx), "", userID)
err = g.msgClient.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.JoinGroupApplicationNotification, constant.SuperGroupChatType, joinGroupApplicationTips)
err = g.msgClient.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.JoinGroupApplicationNotification, tips)
if err != nil {
log.ZError(ctx, "JoinGroupApplicationNotification failed", err, "group", req.GroupID, "userID", userID)
}
@@ -382,14 +381,14 @@ func (g *GroupNotificationSender) MemberQuitNotification(ctx context.Context, re
if err != nil {
return err
}
memberQuitTips := &sdkws.MemberQuitTips{Group: group, QuitUser: &sdkws.GroupMemberFullInfo{
tips := &sdkws.MemberQuitTips{Group: group, QuitUser: &sdkws.GroupMemberFullInfo{
GroupID: group.GroupID,
UserID: user.UserID,
Nickname: user.Nickname,
FaceURL: user.FaceURL,
}}
for _, userID := range append(userIDs, opUserID) {
err := g.groupNotification(ctx, constant.MemberQuitNotification, memberQuitTips, mcontext.GetOpUserID(ctx), "", userID)
err = g.msgClient.Notification(ctx, mcontext.GetOpUserID(ctx), userID, constant.MemberQuitNotification, tips)
if err != nil {
return err
}