conversationID

This commit is contained in:
wangchuxiao
2023-05-06 10:42:11 +08:00
parent 72aa6d5eab
commit c9334ca827
4 changed files with 63 additions and 38 deletions
+18
View File
@@ -112,6 +112,24 @@ func GetConversationIDBySessionType(sessionType int, ids ...string) string {
return ""
}
func GetNotificationConversationIDBySessionType(sessionType int, ids ...string) string {
sort.Strings(ids)
if len(ids) > 2 || len(ids) < 1 {
return ""
}
switch sessionType {
case constant.SingleChatType:
return "n_" + strings.Join(ids, "_") // single chat
case constant.GroupChatType:
return "n_" + ids[0] // group chat
case constant.SuperGroupChatType:
return "n_" + ids[0] // super group chat
case constant.NotificationChatType:
return "n_" + ids[0] // server notification chat
}
return ""
}
func IsNotification(conversationID string) bool {
return strings.HasPrefix(conversationID, "n_")
}