From 4ae5acefc0f6df138fd8a054788f7394a52b7cd0 Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Fri, 19 May 2023 14:21:18 +0800 Subject: [PATCH] group notification --- pkg/common/db/controller/conversation.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/common/db/controller/conversation.go b/pkg/common/db/controller/conversation.go index cb2dc6f15..cc27f8f73 100644 --- a/pkg/common/db/controller/conversation.go +++ b/pkg/common/db/controller/conversation.go @@ -221,9 +221,11 @@ func (c *ConversationDataBase) CreateGroupChatConversation(ctx context.Context, conversations = append(conversations, &conversation) } cache = cache.DelConversationIDs(notExistUserIDs...).DelUserConversationIDsHash(notExistUserIDs...) - err = c.conversationDB.Create(ctx, conversations) - if err != nil { - return err + if len(conversations) > 0 { + err = c.conversationDB.Create(ctx, conversations) + if err != nil { + return err + } } _, err = c.conversationDB.UpdateByMap(ctx, existConversationUserIDs, conversationID, map[string]interface{}{"max_seq": 0}) if err != nil {