@ -26,11 +26,16 @@ import (
"github.com/OpenIMSDK/tools/log"
"github.com/OpenIMSDK/tools/log"
)
)
func ( m * msgServer ) GetConversationsHasReadAndMaxSeq ( ctx context . Context , req * msg . GetConversationsHasReadAndMaxSeqReq ) ( * msg . GetConversationsHasReadAndMaxSeqResp , error ) {
func ( m * msgServer ) GetConversationsHasReadAndMaxSeq ( ctx context . Context , req * msg . GetConversationsHasReadAndMaxSeqReq ) ( resp * msg . GetConversationsHasReadAndMaxSeqResp , err error ) {
conversationIDs , err := m . ConversationLocalCache . GetConversationIDs ( ctx , req . UserID )
var conversationIDs [ ] string
if len ( req . ConversationIDs ) == 0 {
conversationIDs , err = m . ConversationLocalCache . GetConversationIDs ( ctx , req . UserID )
if err != nil {
if err != nil {
return nil , err
return nil , err
}
}
} else {
conversationIDs = req . ConversationIDs
}
hasReadSeqs , err := m . MsgDatabase . GetHasReadSeqs ( ctx , req . UserID , conversationIDs )
hasReadSeqs , err := m . MsgDatabase . GetHasReadSeqs ( ctx , req . UserID , conversationIDs )
if err != nil {
if err != nil {
return nil , err
return nil , err
@ -49,7 +54,7 @@ func (m *msgServer) GetConversationsHasReadAndMaxSeq(ctx context.Context, req *m
if err != nil {
if err != nil {
return nil , err
return nil , err
}
}
resp : = & msg . GetConversationsHasReadAndMaxSeqResp { Seqs : make ( map [ string ] * msg . Seqs ) }
resp = & msg . GetConversationsHasReadAndMaxSeqResp { Seqs : make ( map [ string ] * msg . Seqs ) }
for conversarionID , maxSeq := range maxSeqs {
for conversarionID , maxSeq := range maxSeqs {
resp . Seqs [ conversarionID ] = & msg . Seqs {
resp . Seqs [ conversarionID ] = & msg . Seqs {
HasReadSeq : hasReadSeqs [ conversarionID ] ,
HasReadSeq : hasReadSeqs [ conversarionID ] ,