mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-12 04:55:59 +08:00
delete sync
This commit is contained in:
@@ -2,10 +2,11 @@ package rpcclient
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
|
||||
discoveryRegistry "github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/conversation"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/errs"
|
||||
pbConversation "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/conversation"
|
||||
)
|
||||
|
||||
@@ -22,7 +23,7 @@ func (c *ConversationClient) ModifyConversationField(ctx context.Context, req *p
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = conversation.NewConversationClient(cc).ModifyConversationField(ctx, req)
|
||||
_, err = pbConversation.NewConversationClient(cc).ModifyConversationField(ctx, req)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -31,10 +32,10 @@ func (c *ConversationClient) GetSingleConversationRecvMsgOpt(ctx context.Context
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
var req conversation.GetConversationReq
|
||||
var req pbConversation.GetConversationReq
|
||||
req.OwnerUserID = userID
|
||||
req.ConversationID = conversationID
|
||||
conversation, err := conversation.NewConversationClient(cc).GetConversation(ctx, &req)
|
||||
conversation, err := pbConversation.NewConversationClient(cc).GetConversation(ctx, &req)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
@@ -46,7 +47,7 @@ func (c *ConversationClient) SingleChatFirstCreateConversation(ctx context.Conte
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = conversation.NewConversationClient(cc).CreateSingleChatConversations(ctx, &pbConversation.CreateSingleChatConversationsReq{RecvID: recvID, SendID: sendID})
|
||||
_, err = pbConversation.NewConversationClient(cc).CreateSingleChatConversations(ctx, &pbConversation.CreateSingleChatConversationsReq{RecvID: recvID, SendID: sendID})
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -55,7 +56,7 @@ func (c *ConversationClient) GroupChatFirstCreateConversation(ctx context.Contex
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = conversation.NewConversationClient(cc).CreateGroupChatConversations(ctx, &pbConversation.CreateGroupChatConversationsReq{UserIDs: userIDs, GroupID: groupID})
|
||||
_, err = pbConversation.NewConversationClient(cc).CreateGroupChatConversations(ctx, &pbConversation.CreateGroupChatConversationsReq{UserIDs: userIDs, GroupID: groupID})
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -64,7 +65,7 @@ func (c *ConversationClient) DelGroupChatConversations(ctx context.Context, owne
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = conversation.NewConversationClient(cc).DelGroupChatConversations(ctx, &pbConversation.DelGroupChatConversationsReq{OwnerUserID: ownerUserIDs, GroupID: groupID, MaxSeq: maxSeq})
|
||||
_, err = pbConversation.NewConversationClient(cc).DelGroupChatConversations(ctx, &pbConversation.DelGroupChatConversationsReq{OwnerUserID: ownerUserIDs, GroupID: groupID, MaxSeq: maxSeq})
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -73,8 +74,11 @@ func (c *ConversationClient) GetConversationIDs(ctx context.Context, ownerUserID
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp, err := conversation.NewConversationClient(cc).GetConversationIDs(ctx, &pbConversation.GetConversationIDsReq{UserID: ownerUserID})
|
||||
return resp.ConversationIDs, err
|
||||
resp, err := pbConversation.NewConversationClient(cc).GetConversationIDs(ctx, &pbConversation.GetConversationIDsReq{UserID: ownerUserID})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp.ConversationIDs, nil
|
||||
}
|
||||
|
||||
func (c *ConversationClient) GetConversation(ctx context.Context, ownerUserID, conversationID string) (*pbConversation.Conversation, error) {
|
||||
@@ -83,14 +87,23 @@ func (c *ConversationClient) GetConversation(ctx context.Context, ownerUserID, c
|
||||
return nil, err
|
||||
}
|
||||
resp, err := pbConversation.NewConversationClient(cc).GetConversation(ctx, &pbConversation.GetConversationReq{OwnerUserID: ownerUserID, ConversationID: conversationID})
|
||||
return resp.Conversation, err
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp.Conversation, nil
|
||||
}
|
||||
|
||||
func (c *ConversationClient) GetConversationByConversationID(ctx context.Context, conversationID string) (*pbConversation.Conversation, error) {
|
||||
func (c *ConversationClient) GetConversationsByConversationID(ctx context.Context, conversationIDs []string) ([]*pbConversation.Conversation, error) {
|
||||
cc, err := c.getConn(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp, err := pbConversation.NewConversationClient(cc).GetConversationByConversationID(ctx, &pbConversation.GetConversationByConversationIDReq{ConversationID: conversationID})
|
||||
return resp.Conversation, err
|
||||
resp, err := pbConversation.NewConversationClient(cc).GetConversationsByConversationID(ctx, &pbConversation.GetConversationsByConversationIDReq{ConversationIDs: conversationIDs})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(resp.Conversations) == 0 {
|
||||
return nil, errs.ErrRecordNotFound.Wrap(fmt.Sprintf("conversationIDs: %v not found", conversationIDs))
|
||||
}
|
||||
return resp.Conversations, nil
|
||||
}
|
||||
|
||||
@@ -54,5 +54,5 @@ func (f *FriendClient) GetFriendIDs(ctx context.Context, ownerUserID string) (fr
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp.FriendIDs, err
|
||||
return resp.FriendIDs, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user