kick group invite group update

This commit is contained in:
Gordon
2022-04-21 16:46:48 +08:00
committed by Xinwei Xiong(cubxxw-openim)
parent 541dacd293
commit f0aa679b6d
3 changed files with 169 additions and 6 deletions
@@ -384,7 +384,7 @@ func GetConversation(OwnerUserID, conversationID string) (db.Conversation, error
err = dbConn.Model(&db.Conversation{
OwnerUserID: OwnerUserID,
ConversationID: conversationID,
}).Find(&conversation).Error
}).Take(&conversation).Error
return conversation, err
}
@@ -397,3 +397,12 @@ func GetConversations(OwnerUserID string, conversationIDs []string) ([]db.Conver
err = dbConn.Model(&db.Conversation{}).Where("conversation_id IN (?) and owner_user_id=?", conversationIDs, OwnerUserID).Find(&conversations).Error
return conversations, err
}
func GetConversationsByConversationIDMultipleOwner(OwnerUserIDList []string, conversationID string) ([]db.Conversation, error) {
var conversations []db.Conversation
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
if err != nil {
return conversations, err
}
err = dbConn.Model(&db.Conversation{}).Where("owner_user_id IN (?) and conversation_id=?", OwnerUserIDList, conversationID).Find(&conversations).Error
return conversations, err
}
+38
View File
@@ -77,6 +77,44 @@ func Difference(slice1, slice2 []uint32) []uint32 {
}
return n
}
//Get the intersection of two slices
func IntersectString(slice1, slice2 []string) []string {
m := make(map[string]bool)
n := make([]string, 0)
for _, v := range slice1 {
m[v] = true
}
for _, v := range slice2 {
flag, _ := m[v]
if flag {
n = append(n, v)
}
}
return n
}
//Get the diff of two slices
func DifferenceString(slice1, slice2 []string) []string {
m := make(map[string]bool)
n := make([]string, 0)
inter := IntersectString(slice1, slice2)
for _, v := range inter {
m[v] = true
}
for _, v := range slice1 {
if !m[v] {
n = append(n, v)
}
}
for _, v := range slice2 {
if !m[v] {
n = append(n, v)
}
}
return n
}
func OperationIDGenerator() string {
return strconv.FormatInt(time.Now().UnixNano()+int64(rand.Uint32()), 10)
}