diff --git a/go.mod b/go.mod index 345cf044d..5e8e7275b 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.19 require ( firebase.google.com/go v3.13.0+incompatible - github.com/OpenIMSDK/protocol v0.0.46 + github.com/OpenIMSDK/protocol v0.0.47 github.com/OpenIMSDK/tools v0.0.23 github.com/bwmarrin/snowflake v0.3.0 // indirect github.com/dtm-labs/rockscache v0.1.1 diff --git a/internal/api/conversation.go b/internal/api/conversation.go index 6463cbde6..eb735e550 100644 --- a/internal/api/conversation.go +++ b/internal/api/conversation.go @@ -33,8 +33,8 @@ func (o *ConversationApi) GetAllConversations(c *gin.Context) { a2r.Call(conversation.ConversationClient.GetAllConversations, o.Client, c) } -func (o *ConversationApi) GetConversationsList(c *gin.Context) { - a2r.Call(conversation.ConversationClient.GetConversationList, o.Client, c) +func (o *ConversationApi) GetSortedConversationList(c *gin.Context) { + a2r.Call(conversation.ConversationClient.GetSortedConversationList, o.Client, c) } func (o *ConversationApi) GetConversation(c *gin.Context) { diff --git a/internal/api/route.go b/internal/api/route.go index 1c91f4dde..fa34f109a 100644 --- a/internal/api/route.go +++ b/internal/api/route.go @@ -204,7 +204,7 @@ func NewGinRouter(discov discoveryregistry.SvcDiscoveryRegistry, rdb redis.Unive conversationGroup := r.Group("/conversation", ParseToken) { c := NewConversationApi(*conversationRpc) - conversationGroup.POST("/get_conversations_list", c.GetConversationsList) + conversationGroup.POST("/get_sorted_conversation_list", c.GetSortedConversationList) conversationGroup.POST("/get_all_conversations", c.GetAllConversations) conversationGroup.POST("/get_conversation", c.GetConversation) conversationGroup.POST("/get_conversations", c.GetConversations) diff --git a/internal/rpc/conversation/conversaion.go b/internal/rpc/conversation/conversaion.go index b80e32953..9ce5a3b67 100644 --- a/internal/rpc/conversation/conversaion.go +++ b/internal/rpc/conversation/conversaion.go @@ -89,7 +89,7 @@ func (c *conversationServer) GetConversation(ctx context.Context, req *pbconvers return resp, nil } -func (m *conversationServer) GetConversationList(ctx context.Context, req *pbconversation.GetConversationListReq) (resp *pbconversation.GetConversationListResp, err error) { +func (m *conversationServer) GetSortedConversationList(ctx context.Context, req *pbconversation.GetSortedConversationListReq) (resp *pbconversation.GetSortedConversationListResp, err error) { log.ZDebug(ctx, "GetConversationList", "seqs", req, "userID", req.UserID) var conversationIDs []string if len(req.ConversationIDs) == 0 { @@ -134,25 +134,25 @@ func (m *conversationServer) GetConversationList(ctx context.Context, req *pbcon conversation_unreadCount[conversationID] = maxSeq - hasReadSeqs[conversationID] } - conversation_isPinkTime := make(map[int64]string) - conversation_notPinkTime := make(map[int64]string) + conversation_isPinTime := make(map[int64]string) + conversation_notPinTime := make(map[int64]string) for _, v := range conversations { conversationID := v.ConversationID time := conversationMsg[conversationID].MsgInfo.LatestMsgRecvTime conversationMsg[conversationID].RecvMsgOpt = v.RecvMsgOpt if v.IsPinned { conversationMsg[conversationID].IsPinned = v.IsPinned - conversation_isPinkTime[time] = conversationID + conversation_isPinTime[time] = conversationID continue } - conversation_notPinkTime[time] = conversationID + conversation_notPinTime[time] = conversationID } - resp = &pbconversation.GetConversationListResp{ + resp = &pbconversation.GetSortedConversationListResp{ ConversationElems: []*pbconversation.ConversationElem{}, } - m.conversationSort(conversation_isPinkTime, resp, conversation_unreadCount, conversationMsg) - m.conversationSort(conversation_notPinkTime, resp, conversation_unreadCount, conversationMsg) + m.conversationSort(conversation_isPinTime, resp, conversation_unreadCount, conversationMsg) + m.conversationSort(conversation_notPinTime, resp, conversation_unreadCount, conversationMsg) return resp, nil } @@ -425,7 +425,7 @@ func (c *conversationServer) GetConversationOfflinePushUserIDs( func (c *conversationServer) conversationSort( conversations map[int64]string, - resp *pbconversation.GetConversationListResp, + resp *pbconversation.GetSortedConversationListResp, conversation_unreadCount map[string]int64, conversationMsg map[string]*pbconversation.ConversationElem, ) {