diff --git a/internal/push/push_to_client.go b/internal/push/push_to_client.go index 772cbdb46..e82fe887f 100644 --- a/internal/push/push_to_client.go +++ b/internal/push/push_to_client.go @@ -18,6 +18,7 @@ import ( "context" "encoding/json" "errors" + "github.com/OpenIMSDK/protocol/conversation" "github.com/openimsdk/open-im-server/v3/pkg/msgprocessor" @@ -235,7 +236,10 @@ func (p *Pusher) Push2SuperGroup(ctx context.Context, groupID string, msg *sdkws if len(offlinePushUserIDs) > 0 { needOfflinePushUserIDs = offlinePushUserIDs } - resp, err := p.conversationRpcClient.Client.GetConversationNeedOfflinePushUserIDs(ctx, &conversation.GetConversationNeedOfflinePushUserIDsReq{ConversationID: utils.GenGroupConversationID(groupID), OwnerUserIDs: needOfflinePushUserIDs}) + resp, err := p.conversationRpcClient.Client.GetConversationNeedOfflinePushUserIDs( + ctx, + &conversation.GetConversationNeedOfflinePushUserIDsReq{ConversationID: utils.GenGroupConversationID(groupID), OwnerUserIDs: needOfflinePushUserIDs}, + ) if err != nil { return err } diff --git a/internal/rpc/conversation/conversaion.go b/internal/rpc/conversation/conversaion.go index 36e92c04d..acd996ed6 100644 --- a/internal/rpc/conversation/conversaion.go +++ b/internal/rpc/conversation/conversaion.go @@ -301,7 +301,10 @@ func (c *conversationServer) GetConversationsByConversationID( return &pbconversation.GetConversationsByConversationIDResp{Conversations: convert.ConversationsDB2Pb(conversations)}, nil } -func (c *conversationServer) GetConversationNeedOfflinePushUserIDs(ctx context.Context, req *pbconversation.GetConversationNeedOfflinePushUserIDsReq) (*pbconversation.GetConversationNeedOfflinePushUserIDsResp, error) { +func (c *conversationServer) GetConversationNeedOfflinePushUserIDs( + ctx context.Context, + req *pbconversation.GetConversationNeedOfflinePushUserIDsReq, +) (*pbconversation.GetConversationNeedOfflinePushUserIDsResp, error) { if req.ConversationID == "" { return nil, errs.ErrArgs.Wrap("conversationID is empty") } diff --git a/pkg/common/db/relation/conversation_model.go b/pkg/common/db/relation/conversation_model.go index 60a27b185..baf20a0d3 100644 --- a/pkg/common/db/relation/conversation_model.go +++ b/pkg/common/db/relation/conversation_model.go @@ -16,6 +16,7 @@ package relation import ( "context" + "github.com/OpenIMSDK/tools/errs" "gorm.io/gorm" @@ -218,5 +219,11 @@ func (c *ConversationGorm) GetConversationIDsNeedDestruct( func (c *ConversationGorm) GetConversationNeedOfflinePushUserIDs(ctx context.Context, conversationID string, ownerUserIDs []string) ([]string, error) { var userIDs []string - return userIDs, errs.Wrap(c.db(ctx).Model(&relation.ConversationModel{}).Where("conversation_id = ? and owner_user_id in ? and recv_msg_opt = ?", conversationID, ownerUserIDs, constant.ReceiveMessage).Pluck("owner_user_id", &userIDs).Error) + return userIDs, errs.Wrap( + c.db(ctx). + Model(&relation.ConversationModel{}). + Where("conversation_id = ? and owner_user_id in ? and recv_msg_opt = ?", conversationID, ownerUserIDs, constant.ReceiveMessage). + Pluck("owner_user_id", &userIDs). + Error, + ) }