mirror of
				https://github.com/openimsdk/open-im-server.git
				synced 2025-10-29 15:30:03 +08:00 
			
		
		
		
	* fix: GroupApplicationAcceptedNotification * fix: GroupApplicationAcceptedNotification * fix: NotificationUserInfoUpdate * cicd: robot automated Change * fix: component * fix: getConversationInfo * feat: cron task * feat: cron task * feat: cron task * feat: cron task * feat: cron task * fix: minio config url recognition error * update gomake version * update gomake version * fix: seq conversion bug * fix: redis pipe exec * fix: ImportFriends * fix: A large number of logs keysAndValues length is not even * feat: mark read aggregate write * feat: online status supports redis cluster * feat: online status supports redis cluster * feat: online status supports redis cluster * merge * merge * read seq is written to mongo * read seq is written to mongo * fix: invitation to join group notification * fix: friend op_user_id * feat: optimizing asynchronous context * feat: optimizing memamq size * feat: add GetSeqMessage * feat: GroupApplicationAgreeMemberEnterNotification * feat: GroupApplicationAgreeMemberEnterNotification * feat: go.mod * feat: go.mod * feat: join group notification and get seq --------- Co-authored-by: withchao <withchao@users.noreply.github.com>
		
			
				
	
	
		
			55 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			55 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| package conversationutil
 | |
| 
 | |
| import (
 | |
| 	"sort"
 | |
| 	"strings"
 | |
| )
 | |
| 
 | |
| func GenConversationIDForSingle(sendID, recvID string) string {
 | |
| 	l := []string{sendID, recvID}
 | |
| 	sort.Strings(l)
 | |
| 	return "si_" + strings.Join(l, "_")
 | |
| }
 | |
| 
 | |
| func GenConversationUniqueKeyForGroup(groupID string) string {
 | |
| 	return groupID
 | |
| }
 | |
| 
 | |
| func GenGroupConversationID(groupID string) string {
 | |
| 	return "sg_" + groupID
 | |
| }
 | |
| 
 | |
| func IsGroupConversationID(conversationID string) bool {
 | |
| 	return strings.HasPrefix(conversationID, "sg_")
 | |
| }
 | |
| 
 | |
| func IsNotificationConversationID(conversationID string) bool {
 | |
| 	return strings.HasPrefix(conversationID, "n_")
 | |
| }
 | |
| 
 | |
| func GenConversationUniqueKeyForSingle(sendID, recvID string) string {
 | |
| 	l := []string{sendID, recvID}
 | |
| 	sort.Strings(l)
 | |
| 	return strings.Join(l, "_")
 | |
| }
 | |
| 
 | |
| func GetNotificationConversationIDByConversationID(conversationID string) string {
 | |
| 	l := strings.Split(conversationID, "_")
 | |
| 	if len(l) > 1 {
 | |
| 		l[0] = "n"
 | |
| 		return strings.Join(l, "_")
 | |
| 	}
 | |
| 	return ""
 | |
| }
 | |
| 
 | |
| func GetSelfNotificationConversationID(userID string) string {
 | |
| 	return "n_" + userID + "_" + userID
 | |
| }
 | |
| 
 | |
| func GetSeqsBeginEnd(seqs []int64) (int64, int64) {
 | |
| 	if len(seqs) == 0 {
 | |
| 		return 0, 0
 | |
| 	}
 | |
| 	return seqs[0], seqs[len(seqs)-1]
 | |
| }
 |