|
|
@ -104,7 +104,7 @@ func (c *conversationDatabase) SetUsersConversationFiledTx(ctx context.Context,
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cache = cache.DelConversationIDs(NotUserIDs...).DelUserConversationIDsHash(NotUserIDs...).DelConvsersations(conversation.ConversationID, NotUserIDs...)
|
|
|
|
cache = cache.DelConversationIDs(NotUserIDs...).DelUserConversationIDsHash(NotUserIDs...).DelConversations(conversation.ConversationID, NotUserIDs...)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
}); err != nil {
|
|
|
|
}); err != nil {
|
|
|
@ -128,7 +128,7 @@ func (c *conversationDatabase) CreateConversation(ctx context.Context, conversat
|
|
|
|
var userIDs []string
|
|
|
|
var userIDs []string
|
|
|
|
cache := c.cache.NewCache()
|
|
|
|
cache := c.cache.NewCache()
|
|
|
|
for _, conversation := range conversations {
|
|
|
|
for _, conversation := range conversations {
|
|
|
|
cache = cache.DelConvsersations(conversation.OwnerUserID, conversation.ConversationID)
|
|
|
|
cache = cache.DelConversations(conversation.OwnerUserID, conversation.ConversationID)
|
|
|
|
userIDs = append(userIDs, conversation.OwnerUserID)
|
|
|
|
userIDs = append(userIDs, conversation.OwnerUserID)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return cache.DelConversationIDs(userIDs...).DelUserConversationIDsHash(userIDs...).ExecDel(ctx)
|
|
|
|
return cache.DelConversationIDs(userIDs...).DelUserConversationIDsHash(userIDs...).ExecDel(ctx)
|
|
|
@ -190,7 +190,7 @@ func (c *conversationDatabase) SetUserConversations(ctx context.Context, ownerUs
|
|
|
|
var conversationIDs []string
|
|
|
|
var conversationIDs []string
|
|
|
|
for _, conversation := range conversations {
|
|
|
|
for _, conversation := range conversations {
|
|
|
|
conversationIDs = append(conversationIDs, conversation.ConversationID)
|
|
|
|
conversationIDs = append(conversationIDs, conversation.ConversationID)
|
|
|
|
cache = cache.DelConvsersations(conversation.OwnerUserID, conversation.ConversationID)
|
|
|
|
cache = cache.DelConversations(conversation.OwnerUserID, conversation.ConversationID)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
conversationTx := c.conversationDB.NewTx(tx)
|
|
|
|
conversationTx := c.conversationDB.NewTx(tx)
|
|
|
|
existConversations, err := conversationTx.Find(ctx, ownerUserID, conversationIDs)
|
|
|
|
existConversations, err := conversationTx.Find(ctx, ownerUserID, conversationIDs)
|
|
|
@ -247,7 +247,7 @@ func (c *conversationDatabase) CreateGroupChatConversation(ctx context.Context,
|
|
|
|
for _, v := range notExistUserIDs {
|
|
|
|
for _, v := range notExistUserIDs {
|
|
|
|
conversation := relationTb.ConversationModel{ConversationType: constant.SuperGroupChatType, GroupID: groupID, OwnerUserID: v, ConversationID: conversationID}
|
|
|
|
conversation := relationTb.ConversationModel{ConversationType: constant.SuperGroupChatType, GroupID: groupID, OwnerUserID: v, ConversationID: conversationID}
|
|
|
|
conversations = append(conversations, &conversation)
|
|
|
|
conversations = append(conversations, &conversation)
|
|
|
|
cache = cache.DelConvsersations(v, conversationID)
|
|
|
|
cache = cache.DelConversations(v, conversationID)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cache = cache.DelConversationIDs(notExistUserIDs...).DelUserConversationIDsHash(notExistUserIDs...)
|
|
|
|
cache = cache.DelConversationIDs(notExistUserIDs...).DelUserConversationIDsHash(notExistUserIDs...)
|
|
|
|
if len(conversations) > 0 {
|
|
|
|
if len(conversations) > 0 {
|
|
|
@ -261,7 +261,7 @@ func (c *conversationDatabase) CreateGroupChatConversation(ctx context.Context,
|
|
|
|
return err
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for _, v := range existConversationUserIDs {
|
|
|
|
for _, v := range existConversationUserIDs {
|
|
|
|
cache = cache.DelConvsersations(v, conversationID)
|
|
|
|
cache = cache.DelConversations(v, conversationID)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
}); err != nil {
|
|
|
|
}); err != nil {
|
|
|
|