@@ -513,14 +513,6 @@ func (c *conversationServer) GetUserConversationIDsHash(ctx context.Context, req
513513 return & pbconversation.GetUserConversationIDsHashResp {Hash : hash }, nil
514514}
515515
516- func (c * conversationServer ) GetConversationsByConversationID (ctx context.Context , req * pbconversation.GetConversationsByConversationIDReq ) (* pbconversation.GetConversationsByConversationIDResp , error ) {
517- conversations , err := c .conversationDatabase .GetConversationsByConversationID (ctx , req .ConversationIDs )
518- if err != nil {
519- return nil , err
520- }
521- return & pbconversation.GetConversationsByConversationIDResp {Conversations : convert .ConversationsDB2Pb (conversations )}, nil
522- }
523-
524516func (c * conversationServer ) GetConversationOfflinePushUserIDs (ctx context.Context , req * pbconversation.GetConversationOfflinePushUserIDsReq ) (* pbconversation.GetConversationOfflinePushUserIDsResp , error ) {
525517 if req .ConversationID == "" {
526518 return nil , errs .ErrArgs .WrapMsg ("conversationID is empty" )
@@ -717,56 +709,6 @@ func (c *conversationServer) GetOwnerConversation(ctx context.Context, req *pbco
717709 }, nil
718710}
719711
720- func (c * conversationServer ) GetConversationsNeedClearMsg (ctx context.Context , _ * pbconversation.GetConversationsNeedClearMsgReq ) (* pbconversation.GetConversationsNeedClearMsgResp , error ) {
721- num , err := c .conversationDatabase .GetAllConversationIDsNumber (ctx )
722- if err != nil {
723- log .ZError (ctx , "GetAllConversationIDsNumber failed" , err )
724- return nil , err
725- }
726- const batchNum = 100
727-
728- if num == 0 {
729- return nil , errs .New ("Need Destruct Msg is nil" ).Wrap ()
730- }
731-
732- maxPage := (num + batchNum - 1 ) / batchNum
733-
734- temp := make ([]* dbModel.Conversation , 0 , maxPage * batchNum )
735-
736- for pageNumber := 0 ; pageNumber < int (maxPage ); pageNumber ++ {
737- pagination := & sdkws.RequestPagination {
738- PageNumber : int32 (pageNumber ),
739- ShowNumber : batchNum ,
740- }
741-
742- conversationIDs , err := c .conversationDatabase .PageConversationIDs (ctx , pagination )
743- if err != nil {
744- log .ZError (ctx , "PageConversationIDs failed" , err , "pageNumber" , pageNumber )
745- continue
746- }
747-
748- // log.ZDebug(ctx, "PageConversationIDs success", "pageNumber", pageNumber, "conversationIDsNum", len(conversationIDs), "conversationIDs", conversationIDs)
749- if len (conversationIDs ) == 0 {
750- continue
751- }
752-
753- conversations , err := c .conversationDatabase .GetConversationsByConversationID (ctx , conversationIDs )
754- if err != nil {
755- log .ZError (ctx , "GetConversationsByConversationID failed" , err , "conversationIDs" , conversationIDs )
756- continue
757- }
758-
759- for _ , conversation := range conversations {
760- if conversation .IsMsgDestruct && conversation .MsgDestructTime != 0 && ((time .Now ().UnixMilli () > (conversation .MsgDestructTime + conversation .LatestMsgDestructTime .UnixMilli () + 8 * 60 * 60 )) || // 8*60*60 is UTC+8
761- conversation .LatestMsgDestructTime .IsZero ()) {
762- temp = append (temp , conversation )
763- }
764- }
765- }
766-
767- return & pbconversation.GetConversationsNeedClearMsgResp {Conversations : convert .ConversationsDB2Pb (temp )}, nil
768- }
769-
770712func (c * conversationServer ) GetNotNotifyConversationIDs (ctx context.Context , req * pbconversation.GetNotNotifyConversationIDsReq ) (* pbconversation.GetNotNotifyConversationIDsResp , error ) {
771713 if err := authverify .CheckAccess (ctx , req .UserID ); err != nil {
772714 return nil , err
0 commit comments