mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
fix conversation created
This commit is contained in:
parent
df888d22e7
commit
bba7f47767
@ -10,6 +10,7 @@ import (
|
|||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/relation"
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/relation"
|
||||||
tableRelation "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
|
tableRelation "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
|
||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/tx"
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/tx"
|
||||||
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"
|
||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry"
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry"
|
||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/errs"
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/errs"
|
||||||
pbConversation "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/conversation"
|
pbConversation "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/conversation"
|
||||||
@ -261,14 +262,19 @@ func (c *conversationServer) CreateSingleChatConversations(ctx context.Context,
|
|||||||
var conversation tableRelation.ConversationModel
|
var conversation tableRelation.ConversationModel
|
||||||
conversation.ConversationID = utils.GetConversationIDBySessionType(constant.SingleChatType, req.RecvID, req.SendID)
|
conversation.ConversationID = utils.GetConversationIDBySessionType(constant.SingleChatType, req.RecvID, req.SendID)
|
||||||
conversation.ConversationType = constant.SingleChatType
|
conversation.ConversationType = constant.SingleChatType
|
||||||
|
conversation.OwnerUserID = req.SendID
|
||||||
|
conversation.UserID = req.RecvID
|
||||||
|
err := c.conversationDatabase.CreateConversation(ctx, []*tableRelation.ConversationModel{&conversation})
|
||||||
|
if err != nil {
|
||||||
|
log.ZWarn(ctx, "create conversation failed", err, "conversation", conversation)
|
||||||
|
}
|
||||||
|
|
||||||
conversation2 := conversation
|
conversation2 := conversation
|
||||||
conversation2.OwnerUserID = req.RecvID
|
conversation2.OwnerUserID = req.RecvID
|
||||||
conversation2.UserID = req.SendID
|
conversation2.UserID = req.SendID
|
||||||
conversation.OwnerUserID = req.SendID
|
err = c.conversationDatabase.CreateConversation(ctx, []*tableRelation.ConversationModel{&conversation2})
|
||||||
conversation.UserID = req.RecvID
|
|
||||||
err := c.conversationDatabase.CreateConversation(ctx, []*tableRelation.ConversationModel{&conversation, &conversation2})
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
log.ZWarn(ctx, "create conversation failed", err, "conversation2", conversation)
|
||||||
}
|
}
|
||||||
return &pbConversation.CreateSingleChatConversationsResp{}, nil
|
return &pbConversation.CreateSingleChatConversationsResp{}, nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user