From d369d05ee47f3388b2f54826b5520f25457d42d8 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Sat, 6 May 2023 11:31:04 +0800 Subject: [PATCH] options --- pkg/utils/utils.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index 81f7b27e2..46db24b7a 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -171,16 +171,29 @@ func GetHashCode(s string) uint32 { } func GetConversationIDByMsg(msg *sdkws.MsgData) string { + options := Options(msg.Options) switch msg.SessionType { case constant.SingleChatType: l := []string{msg.SendID, msg.RecvID} sort.Strings(l) + if options.IsNotification() { + return "n_" + strings.Join(l, "_") + } return "si_" + strings.Join(l, "_") // single chat case constant.GroupChatType: + if options.IsNotification() { + return "n_" + msg.GroupID // group chat + } return "g_" + msg.GroupID // group chat case constant.SuperGroupChatType: + if options.IsNotification() { + return "n_" + msg.GroupID // super group chat + } return "sg_" + msg.GroupID // super group chat case constant.NotificationChatType: + if options.IsNotification() { + return "n_" + msg.SendID + "_" + msg.RecvID // super group chat + } return "sn_" + msg.SendID + "_" + msg.RecvID // server notification chat } return ""