conversation

This commit is contained in:
wangchuxiao 2023-03-24 17:34:33 +08:00
parent d9afe8a562
commit 8a073a9dfb
2 changed files with 10 additions and 5 deletions

View File

@ -2,6 +2,8 @@ package group
import ( import (
"context" "context"
"time"
"github.com/OpenIMSDK/Open-IM-Server/pkg/apistruct" "github.com/OpenIMSDK/Open-IM-Server/pkg/apistruct"
"github.com/OpenIMSDK/Open-IM-Server/pkg/callbackstruct" "github.com/OpenIMSDK/Open-IM-Server/pkg/callbackstruct"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
@ -12,7 +14,6 @@ import (
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/group" "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/group"
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/wrapperspb" "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/wrapperspb"
"github.com/OpenIMSDK/Open-IM-Server/pkg/utils" "github.com/OpenIMSDK/Open-IM-Server/pkg/utils"
"time"
) )
func CallbackBeforeCreateGroup(ctx context.Context, req *group.CreateGroupReq) (err error) { func CallbackBeforeCreateGroup(ctx context.Context, req *group.CreateGroupReq) (err error) {

View File

@ -68,12 +68,16 @@ func (c *ConversationDataBase) SetUsersConversationFiledTx(ctx context.Context,
temp.OwnerUserID = v temp.OwnerUserID = v
cList = append(cList, temp) cList = append(cList, temp)
} }
cache := c.cache.NewCache()
if len(cList) > 0 {
err = conversationTx.Create(ctx, cList) err = conversationTx.Create(ctx, cList)
if err != nil { if err != nil {
return err return err
} }
cache = cache.DelConversationIDs(NotUserIDs)
}
// clear cache // clear cache
return c.cache.DelConversationIDs(NotUserIDs).DelUsersConversation(haveUserIDs, conversation.ConversationID).ExecDel(ctx) return cache.DelUsersConversation(haveUserIDs, conversation.ConversationID).ExecDel(ctx)
}) })
} }