@@ -24,7 +24,6 @@ import (
2424 "github.com/openimsdk/open-im-server/v3/pkg/common/config"
2525 "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/redis"
2626 "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database/mgo"
27- "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model"
2827 dbModel "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model"
2928 "github.com/openimsdk/open-im-server/v3/pkg/localcache"
3029 "github.com/openimsdk/open-im-server/v3/pkg/msgprocessor"
@@ -525,17 +524,6 @@ func (c *conversationServer) GetUserConversationIDsHash(ctx context.Context, req
525524 return & pbconversation.GetUserConversationIDsHashResp {Hash : hash }, nil
526525}
527526
528- func (c * conversationServer ) GetConversationsByConversationID (
529- ctx context.Context ,
530- req * pbconversation.GetConversationsByConversationIDReq ,
531- ) (* pbconversation.GetConversationsByConversationIDResp , error ) {
532- conversations , err := c .conversationDatabase .GetConversationsByConversationID (ctx , req .ConversationIDs )
533- if err != nil {
534- return nil , err
535- }
536- return & pbconversation.GetConversationsByConversationIDResp {Conversations : convert .ConversationsDB2Pb (conversations )}, nil
537- }
538-
539527func (c * conversationServer ) GetConversationOfflinePushUserIDs (ctx context.Context , req * pbconversation.GetConversationOfflinePushUserIDsReq ) (* pbconversation.GetConversationOfflinePushUserIDsResp , error ) {
540528 if req .ConversationID == "" {
541529 return nil , errs .ErrArgs .WrapMsg ("conversationID is empty" )
@@ -735,56 +723,6 @@ func (c *conversationServer) GetOwnerConversation(ctx context.Context, req *pbco
735723 }, nil
736724}
737725
738- func (c * conversationServer ) GetConversationsNeedClearMsg (ctx context.Context , _ * pbconversation.GetConversationsNeedClearMsgReq ) (* pbconversation.GetConversationsNeedClearMsgResp , error ) {
739- num , err := c .conversationDatabase .GetAllConversationIDsNumber (ctx )
740- if err != nil {
741- log .ZError (ctx , "GetAllConversationIDsNumber failed" , err )
742- return nil , err
743- }
744- const batchNum = 100
745-
746- if num == 0 {
747- return nil , errs .New ("Need Destruct Msg is nil" ).Wrap ()
748- }
749-
750- maxPage := (num + batchNum - 1 ) / batchNum
751-
752- temp := make ([]* model.Conversation , 0 , maxPage * batchNum )
753-
754- for pageNumber := 0 ; pageNumber < int (maxPage ); pageNumber ++ {
755- pagination := & sdkws.RequestPagination {
756- PageNumber : int32 (pageNumber ),
757- ShowNumber : batchNum ,
758- }
759-
760- conversationIDs , err := c .conversationDatabase .PageConversationIDs (ctx , pagination )
761- if err != nil {
762- log .ZError (ctx , "PageConversationIDs failed" , err , "pageNumber" , pageNumber )
763- continue
764- }
765-
766- // log.ZDebug(ctx, "PageConversationIDs success", "pageNumber", pageNumber, "conversationIDsNum", len(conversationIDs), "conversationIDs", conversationIDs)
767- if len (conversationIDs ) == 0 {
768- continue
769- }
770-
771- conversations , err := c .conversationDatabase .GetConversationsByConversationID (ctx , conversationIDs )
772- if err != nil {
773- log .ZError (ctx , "GetConversationsByConversationID failed" , err , "conversationIDs" , conversationIDs )
774- continue
775- }
776-
777- for _ , conversation := range conversations {
778- if conversation .IsMsgDestruct && conversation .MsgDestructTime != 0 && ((time .Now ().UnixMilli () > (conversation .MsgDestructTime + conversation .LatestMsgDestructTime .UnixMilli () + 8 * 60 * 60 )) || // 8*60*60 is UTC+8
779- conversation .LatestMsgDestructTime .IsZero ()) {
780- temp = append (temp , conversation )
781- }
782- }
783- }
784-
785- return & pbconversation.GetConversationsNeedClearMsgResp {Conversations : convert .ConversationsDB2Pb (temp )}, nil
786- }
787-
788726func (c * conversationServer ) GetNotNotifyConversationIDs (ctx context.Context , req * pbconversation.GetNotNotifyConversationIDsReq ) (* pbconversation.GetNotNotifyConversationIDsResp , error ) {
789727 conversationIDs , err := c .conversationDatabase .GetNotNotifyConversationIDs (ctx , req .UserID )
790728 if err != nil {
0 commit comments