From c16c78aca5015bc1161cce9964c6af2d6851d494 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Thu, 25 May 2023 12:18:02 +0800 Subject: [PATCH] delete --- internal/rpc/msg/delete.go | 46 ++++++++ pkg/common/db/cache/msg.go | 15 +++ pkg/common/db/controller/msg.go | 5 + pkg/proto/msg/msg.pb.go | 201 ++++++++++++++++++++------------ pkg/proto/msg/msg.proto | 2 + 5 files changed, 192 insertions(+), 77 deletions(-) diff --git a/internal/rpc/msg/delete.go b/internal/rpc/msg/delete.go index de953d587..084320583 100644 --- a/internal/rpc/msg/delete.go +++ b/internal/rpc/msg/delete.go @@ -3,21 +3,67 @@ package msg import ( "context" + "github.com/OpenIMSDK/Open-IM-Server/pkg/common/log" + "github.com/OpenIMSDK/Open-IM-Server/pkg/common/tokenverify" "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/msg" ) +func (m *msgServer) getMinSeqs(maxSeqs map[string]int64) map[string]int64 { + minSeqs := make(map[string]int64) + for k, v := range maxSeqs { + minSeqs[k] = v + 1 + } + return minSeqs +} + func (m *msgServer) ClearConversationsMsg(ctx context.Context, req *msg.ClearConversationsMsgReq) (*msg.ClearConversationsMsgResp, error) { + if err := tokenverify.CheckAccessV3(ctx, req.UserID); err != nil { + return nil, err + } + maxSeqs, err := m.MsgDatabase.GetMaxSeqs(ctx, req.ConversationIDs) + if err != nil { + return nil, err + } + if err := m.MsgDatabase.SetUserConversationsMinSeqs(ctx, req.UserID, m.getMinSeqs(maxSeqs)); err != nil { + return nil, err + } return &msg.ClearConversationsMsgResp{}, nil } func (m *msgServer) UserClearAllMsg(ctx context.Context, req *msg.UserClearAllMsgReq) (*msg.UserClearAllMsgResp, error) { + if err := tokenverify.CheckAccessV3(ctx, req.UserID); err != nil { + return nil, err + } + conversationIDs, err := m.Conversation.GetConversationIDs(ctx, req.UserID) + if err != nil { + return nil, err + } + maxSeqs, err := m.MsgDatabase.GetMaxSeqs(ctx, conversationIDs) + if err != nil { + return nil, err + } + if err := m.MsgDatabase.SetUserConversationsMinSeqs(ctx, req.UserID, m.getMinSeqs(maxSeqs)); err != nil { + return nil, err + } return &msg.UserClearAllMsgResp{}, nil } func (m *msgServer) DeleteMsgs(ctx context.Context, req *msg.DeleteMsgsReq) (*msg.DeleteMsgsResp, error) { + if err := tokenverify.CheckAccessV3(ctx, req.UserID); err != nil { + return nil, err + } return &msg.DeleteMsgsResp{}, nil } func (m *msgServer) DeleteMsgPhysicalBySeq(ctx context.Context, req *msg.DeleteMsgPhysicalBySeqReq) (*msg.DeleteMsgPhysicalBySeqResp, error) { return &msg.DeleteMsgPhysicalBySeqResp{}, nil } + +func (m *msgServer) DeleteMsgPhysical(ctx context.Context, req *msg.DeleteMsgPhysicalReq) (*msg.DeleteMsgPhysicalResp, error) { + for _, conversationID := range req.ConversationIDs { + if err := m.MsgDatabase.DeleteConversationMsgsAndSetMinSeq(ctx, conversationID, req.RemainTime); err != nil { + log.ZWarn(ctx, "DeleteConversationMsgsAndSetMinSeq error", err, "conversationID", conversationID, "err", err) + } + } + return &msg.DeleteMsgPhysicalResp{}, nil +} diff --git a/pkg/common/db/cache/msg.go b/pkg/common/db/cache/msg.go index 6d56dba4a..4f5afd05e 100644 --- a/pkg/common/db/cache/msg.go +++ b/pkg/common/db/cache/msg.go @@ -52,7 +52,10 @@ type MsgModel interface { GetConversationUserMinSeq(ctx context.Context, conversationID string, userID string) (int64, error) GetConversationUserMinSeqs(ctx context.Context, conversationID string, userIDs []string) (map[string]int64, error) SetConversationUserMinSeq(ctx context.Context, conversationID string, userID string, minSeq int64) error + // seqs map: key userID value minSeq SetConversationUserMinSeqs(ctx context.Context, conversationID string, seqs map[string]int64) (err error) + // seqs map: key conversationID value minSeq + SetUserConversationsMinSeqs(ctx context.Context, userID string, seqs map[string]int64) error AddTokenFlag(ctx context.Context, userID string, platformID int, token string, flag int) error GetTokensWithoutError(ctx context.Context, userID, platformID string) (map[string]int, error) @@ -195,6 +198,18 @@ func (c *msgCache) SetConversationUserMinSeqs(ctx context.Context, conversationI return err } +func (c *msgCache) SetUserConversationsMinSeqs(ctx context.Context, userID string, seqs map[string]int64) (err error) { + pipe := c.rdb.Pipeline() + for conversationID, minSeq := range seqs { + err = pipe.Set(ctx, c.getConversationUserMinSeqKey(conversationID, userID), minSeq, 0).Err() + if err != nil { + return errs.Wrap(err) + } + } + _, err = pipe.Exec(ctx) + return err +} + func (c *msgCache) AddTokenFlag(ctx context.Context, userID string, platformID int, token string, flag int) error { key := uidPidToken + userID + ":" + constant.PlatformIDToName(platformID) return errs.Wrap(c.rdb.HSet(ctx, key, token, flag).Err()) diff --git a/pkg/common/db/controller/msg.go b/pkg/common/db/controller/msg.go index 62abb2bc7..f47ce05a7 100644 --- a/pkg/common/db/controller/msg.go +++ b/pkg/common/db/controller/msg.go @@ -57,6 +57,7 @@ type CommonMsgDatabase interface { GetConversationUserMinSeqs(ctx context.Context, conversationID string, userIDs []string) (map[string]int64, error) SetConversationUserMinSeq(ctx context.Context, conversationID string, userID string, minSeq int64) error SetConversationUserMinSeqs(ctx context.Context, conversationID string, seqs map[string]int64) (err error) + SetUserConversationsMinSeqs(ctx context.Context, userID string, seqs map[string]int64) (err error) GetMongoMaxAndMinSeq(ctx context.Context, conversationID string) (maxSeq, minSeq int64, err error) GetConversationMinMaxSeqInMongoAndCache(ctx context.Context, conversationID string) (minSeqMongo, maxSeqMongo, minSeqCache, maxSeqCache int64, err error) @@ -679,6 +680,10 @@ func (db *commonMsgDatabase) SetConversationUserMinSeqs(ctx context.Context, con return db.cache.SetConversationUserMinSeqs(ctx, conversationID, seqs) } +func (db *commonMsgDatabase) SetUserConversationsMinSeqs(ctx context.Context, userID string, seqs map[string]int64) error { + return db.cache.SetUserConversationsMinSeqs(ctx, userID, seqs) +} + func (db *commonMsgDatabase) SetSendMsgStatus(ctx context.Context, id string, status int32) error { return db.cache.SetSendMsgStatus(ctx, id, status) } diff --git a/pkg/proto/msg/msg.pb.go b/pkg/proto/msg/msg.pb.go index 379d95d52..7751270b2 100644 --- a/pkg/proto/msg/msg.pb.go +++ b/pkg/proto/msg/msg.pb.go @@ -2576,7 +2576,7 @@ var file_msg_msg_proto_rawDesc = []byte{ 0x6f, 0x6e, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x65, 0x71, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x03, 0x52, 0x04, 0x73, 0x65, 0x71, 0x73, 0x22, 0x1c, 0x0a, 0x1a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x73, 0x67, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x42, 0x79, 0x53, - 0x65, 0x71, 0x52, 0x65, 0x73, 0x70, 0x32, 0xe9, 0x0b, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x12, 0x50, + 0x65, 0x71, 0x52, 0x65, 0x73, 0x70, 0x32, 0xcf, 0x0c, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x12, 0x50, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x78, 0x53, 0x65, 0x71, 0x12, 0x20, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x73, 0x64, 0x6b, 0x77, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x78, 0x53, 0x65, 0x71, 0x52, 0x65, 0x71, 0x1a, 0x21, 0x2e, @@ -2618,63 +2618,70 @@ var file_msg_msg_proto_rawDesc = []byte{ 0x69, 0x63, 0x61, 0x6c, 0x42, 0x79, 0x53, 0x65, 0x71, 0x52, 0x65, 0x71, 0x1a, 0x2c, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x73, 0x67, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, - 0x6c, 0x42, 0x79, 0x53, 0x65, 0x71, 0x52, 0x65, 0x73, 0x70, 0x12, 0x61, 0x0a, 0x10, 0x53, 0x65, - 0x74, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x25, + 0x6c, 0x42, 0x79, 0x53, 0x65, 0x71, 0x52, 0x65, 0x73, 0x70, 0x12, 0x64, 0x0a, 0x11, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x73, 0x67, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x12, + 0x26, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, + 0x73, 0x67, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x73, 0x67, 0x50, 0x68, 0x79, 0x73, + 0x69, 0x63, 0x61, 0x6c, 0x52, 0x65, 0x71, 0x1a, 0x27, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x4d, 0x73, 0x67, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, + 0x12, 0x61, 0x0a, 0x10, 0x53, 0x65, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x12, 0x25, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x53, 0x65, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x4d, + 0x73, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x26, 0x2e, 0x4f, 0x70, + 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x53, + 0x65, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x12, 0x61, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x73, + 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x25, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, + 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x26, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, - 0x67, 0x2e, 0x53, 0x65, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x26, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x53, 0x65, 0x74, 0x53, 0x65, 0x6e, 0x64, - 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x61, 0x0a, - 0x10, 0x47, 0x65, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x12, 0x25, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x26, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, - 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x53, - 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x12, 0x4c, 0x0a, 0x09, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x4d, 0x73, 0x67, 0x12, 0x1e, 0x2e, - 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, - 0x2e, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x1f, 0x2e, - 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, - 0x2e, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x73, 0x70, 0x12, 0x85, - 0x01, 0x0a, 0x1c, 0x53, 0x65, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, - 0x31, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, - 0x73, 0x67, 0x2e, 0x53, 0x65, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, - 0x65, 0x71, 0x1a, 0x32, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, - 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x53, 0x65, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x88, 0x01, 0x0a, 0x1d, 0x47, 0x65, 0x74, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x32, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, - 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x45, - 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x33, 0x2e, 0x4f, - 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, - 0x47, 0x65, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x61, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x12, 0x8b, 0x01, 0x0a, 0x1c, 0x41, 0x64, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x73, 0x12, 0x34, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, - 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x4d, 0x65, 0x73, 0x73, + 0x67, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x4c, 0x0a, 0x09, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, + 0x4d, 0x73, 0x67, 0x12, 0x1e, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x4d, 0x73, 0x67, + 0x52, 0x65, 0x71, 0x1a, 0x1f, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x4d, 0x73, 0x67, + 0x52, 0x65, 0x73, 0x70, 0x12, 0x85, 0x01, 0x0a, 0x1c, 0x53, 0x65, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, - 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x35, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, + 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x31, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x53, 0x65, 0x74, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, + 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x32, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, + 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x53, 0x65, 0x74, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, + 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x88, 0x01, 0x0a, + 0x1d, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x61, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x32, + 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, + 0x67, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x61, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, + 0x65, 0x71, 0x1a, 0x33, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x73, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, + 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x8b, 0x01, 0x0a, 0x1c, 0x41, 0x64, 0x64, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, + 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x34, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, - 0x90, 0x01, 0x0a, 0x1f, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, - 0x6f, 0x6e, 0x73, 0x12, 0x35, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, - 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x36, 0x2e, 0x4f, 0x70, 0x65, - 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x61, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x42, 0x33, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x44, 0x4b, 0x2f, 0x4f, 0x70, 0x65, 0x6e, 0x2d, - 0x49, 0x4d, 0x2d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2f, 0x6d, 0x73, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x35, + 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, + 0x67, 0x2e, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, + 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x90, 0x01, 0x0a, 0x1f, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x45, + 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x35, 0x2e, 0x4f, 0x70, 0x65, 0x6e, + 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, + 0x1a, 0x36, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, + 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x73, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, + 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x42, 0x33, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x44, 0x4b, + 0x2f, 0x4f, 0x70, 0x65, 0x6e, 0x2d, 0x49, 0x4d, 0x2d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, + 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6d, 0x73, 0x67, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2778,29 +2785,31 @@ var file_msg_msg_proto_depIdxs = []int32{ 31, // 31: OpenIMServer.msg.msg.UserClearAllMsg:input_type -> OpenIMServer.msg.UserClearAllMsgReq 33, // 32: OpenIMServer.msg.msg.DeleteMsgs:input_type -> OpenIMServer.msg.DeleteMsgsReq 37, // 33: OpenIMServer.msg.msg.DeleteMsgPhysicalBySeq:input_type -> OpenIMServer.msg.DeleteMsgPhysicalBySeqReq - 8, // 34: OpenIMServer.msg.msg.SetSendMsgStatus:input_type -> OpenIMServer.msg.SetSendMsgStatusReq - 10, // 35: OpenIMServer.msg.msg.GetSendMsgStatus:input_type -> OpenIMServer.msg.GetSendMsgStatusReq - 27, // 36: OpenIMServer.msg.msg.RevokeMsg:input_type -> OpenIMServer.msg.RevokeMsgReq - 13, // 37: OpenIMServer.msg.msg.SetMessageReactionExtensions:input_type -> OpenIMServer.msg.SetMessageReactionExtensionsReq - 15, // 38: OpenIMServer.msg.msg.GetMessagesReactionExtensions:input_type -> OpenIMServer.msg.GetMessagesReactionExtensionsReq - 12, // 39: OpenIMServer.msg.msg.AddMessageReactionExtensions:input_type -> OpenIMServer.msg.ModifyMessageReactionExtensionsReq - 19, // 40: OpenIMServer.msg.msg.DeleteMessageReactionExtensions:input_type -> OpenIMServer.msg.DeleteMessagesReactionExtensionsReq - 49, // 41: OpenIMServer.msg.msg.GetMaxSeq:output_type -> OpenIMServer.sdkws.GetMaxSeqResp - 50, // 42: OpenIMServer.msg.msg.PullMessageBySeqs:output_type -> OpenIMServer.sdkws.PullMessageBySeqsResp - 7, // 43: OpenIMServer.msg.msg.SendMsg:output_type -> OpenIMServer.msg.SendMsgResp - 30, // 44: OpenIMServer.msg.msg.ClearConversationsMsg:output_type -> OpenIMServer.msg.ClearConversationsMsgResp - 32, // 45: OpenIMServer.msg.msg.UserClearAllMsg:output_type -> OpenIMServer.msg.UserClearAllMsgResp - 34, // 46: OpenIMServer.msg.msg.DeleteMsgs:output_type -> OpenIMServer.msg.DeleteMsgsResp - 38, // 47: OpenIMServer.msg.msg.DeleteMsgPhysicalBySeq:output_type -> OpenIMServer.msg.DeleteMsgPhysicalBySeqResp - 9, // 48: OpenIMServer.msg.msg.SetSendMsgStatus:output_type -> OpenIMServer.msg.SetSendMsgStatusResp - 11, // 49: OpenIMServer.msg.msg.GetSendMsgStatus:output_type -> OpenIMServer.msg.GetSendMsgStatusResp - 28, // 50: OpenIMServer.msg.msg.RevokeMsg:output_type -> OpenIMServer.msg.RevokeMsgResp - 14, // 51: OpenIMServer.msg.msg.SetMessageReactionExtensions:output_type -> OpenIMServer.msg.SetMessageReactionExtensionsResp - 16, // 52: OpenIMServer.msg.msg.GetMessagesReactionExtensions:output_type -> OpenIMServer.msg.GetMessagesReactionExtensionsResp - 18, // 53: OpenIMServer.msg.msg.AddMessageReactionExtensions:output_type -> OpenIMServer.msg.ModifyMessageReactionExtensionsResp - 20, // 54: OpenIMServer.msg.msg.DeleteMessageReactionExtensions:output_type -> OpenIMServer.msg.DeleteMessagesReactionExtensionsResp - 41, // [41:55] is the sub-list for method output_type - 27, // [27:41] is the sub-list for method input_type + 35, // 34: OpenIMServer.msg.msg.DeleteMsgPhysical:input_type -> OpenIMServer.msg.DeleteMsgPhysicalReq + 8, // 35: OpenIMServer.msg.msg.SetSendMsgStatus:input_type -> OpenIMServer.msg.SetSendMsgStatusReq + 10, // 36: OpenIMServer.msg.msg.GetSendMsgStatus:input_type -> OpenIMServer.msg.GetSendMsgStatusReq + 27, // 37: OpenIMServer.msg.msg.RevokeMsg:input_type -> OpenIMServer.msg.RevokeMsgReq + 13, // 38: OpenIMServer.msg.msg.SetMessageReactionExtensions:input_type -> OpenIMServer.msg.SetMessageReactionExtensionsReq + 15, // 39: OpenIMServer.msg.msg.GetMessagesReactionExtensions:input_type -> OpenIMServer.msg.GetMessagesReactionExtensionsReq + 12, // 40: OpenIMServer.msg.msg.AddMessageReactionExtensions:input_type -> OpenIMServer.msg.ModifyMessageReactionExtensionsReq + 19, // 41: OpenIMServer.msg.msg.DeleteMessageReactionExtensions:input_type -> OpenIMServer.msg.DeleteMessagesReactionExtensionsReq + 49, // 42: OpenIMServer.msg.msg.GetMaxSeq:output_type -> OpenIMServer.sdkws.GetMaxSeqResp + 50, // 43: OpenIMServer.msg.msg.PullMessageBySeqs:output_type -> OpenIMServer.sdkws.PullMessageBySeqsResp + 7, // 44: OpenIMServer.msg.msg.SendMsg:output_type -> OpenIMServer.msg.SendMsgResp + 30, // 45: OpenIMServer.msg.msg.ClearConversationsMsg:output_type -> OpenIMServer.msg.ClearConversationsMsgResp + 32, // 46: OpenIMServer.msg.msg.UserClearAllMsg:output_type -> OpenIMServer.msg.UserClearAllMsgResp + 34, // 47: OpenIMServer.msg.msg.DeleteMsgs:output_type -> OpenIMServer.msg.DeleteMsgsResp + 38, // 48: OpenIMServer.msg.msg.DeleteMsgPhysicalBySeq:output_type -> OpenIMServer.msg.DeleteMsgPhysicalBySeqResp + 36, // 49: OpenIMServer.msg.msg.DeleteMsgPhysical:output_type -> OpenIMServer.msg.DeleteMsgPhysicalResp + 9, // 50: OpenIMServer.msg.msg.SetSendMsgStatus:output_type -> OpenIMServer.msg.SetSendMsgStatusResp + 11, // 51: OpenIMServer.msg.msg.GetSendMsgStatus:output_type -> OpenIMServer.msg.GetSendMsgStatusResp + 28, // 52: OpenIMServer.msg.msg.RevokeMsg:output_type -> OpenIMServer.msg.RevokeMsgResp + 14, // 53: OpenIMServer.msg.msg.SetMessageReactionExtensions:output_type -> OpenIMServer.msg.SetMessageReactionExtensionsResp + 16, // 54: OpenIMServer.msg.msg.GetMessagesReactionExtensions:output_type -> OpenIMServer.msg.GetMessagesReactionExtensionsResp + 18, // 55: OpenIMServer.msg.msg.AddMessageReactionExtensions:output_type -> OpenIMServer.msg.ModifyMessageReactionExtensionsResp + 20, // 56: OpenIMServer.msg.msg.DeleteMessageReactionExtensions:output_type -> OpenIMServer.msg.DeleteMessagesReactionExtensionsResp + 42, // [42:57] is the sub-list for method output_type + 27, // [27:42] is the sub-list for method input_type 27, // [27:27] is the sub-list for extension type_name 27, // [27:27] is the sub-list for extension extendee 0, // [0:27] is the sub-list for field type_name @@ -3339,6 +3348,8 @@ type MsgClient interface { DeleteMsgs(ctx context.Context, in *DeleteMsgsReq, opts ...grpc.CallOption) (*DeleteMsgsResp, error) // seq物理删除消息 DeleteMsgPhysicalBySeq(ctx context.Context, in *DeleteMsgPhysicalBySeqReq, opts ...grpc.CallOption) (*DeleteMsgPhysicalBySeqResp, error) + // 物理删除消息by 时间 + DeleteMsgPhysical(ctx context.Context, in *DeleteMsgPhysicalReq, opts ...grpc.CallOption) (*DeleteMsgPhysicalResp, error) // 设置消息是否发送成功-针对api发送的消息 SetSendMsgStatus(ctx context.Context, in *SetSendMsgStatusReq, opts ...grpc.CallOption) (*SetSendMsgStatusResp, error) // 获取消息发送状态 @@ -3422,6 +3433,15 @@ func (c *msgClient) DeleteMsgPhysicalBySeq(ctx context.Context, in *DeleteMsgPhy return out, nil } +func (c *msgClient) DeleteMsgPhysical(ctx context.Context, in *DeleteMsgPhysicalReq, opts ...grpc.CallOption) (*DeleteMsgPhysicalResp, error) { + out := new(DeleteMsgPhysicalResp) + err := c.cc.Invoke(ctx, "/OpenIMServer.msg.msg/DeleteMsgPhysical", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *msgClient) SetSendMsgStatus(ctx context.Context, in *SetSendMsgStatusReq, opts ...grpc.CallOption) (*SetSendMsgStatusResp, error) { out := new(SetSendMsgStatusResp) err := c.cc.Invoke(ctx, "/OpenIMServer.msg.msg/SetSendMsgStatus", in, out, opts...) @@ -3501,6 +3521,8 @@ type MsgServer interface { DeleteMsgs(context.Context, *DeleteMsgsReq) (*DeleteMsgsResp, error) // seq物理删除消息 DeleteMsgPhysicalBySeq(context.Context, *DeleteMsgPhysicalBySeqReq) (*DeleteMsgPhysicalBySeqResp, error) + // 物理删除消息by 时间 + DeleteMsgPhysical(context.Context, *DeleteMsgPhysicalReq) (*DeleteMsgPhysicalResp, error) // 设置消息是否发送成功-针对api发送的消息 SetSendMsgStatus(context.Context, *SetSendMsgStatusReq) (*SetSendMsgStatusResp, error) // 获取消息发送状态 @@ -3538,6 +3560,9 @@ func (*UnimplementedMsgServer) DeleteMsgs(context.Context, *DeleteMsgsReq) (*Del func (*UnimplementedMsgServer) DeleteMsgPhysicalBySeq(context.Context, *DeleteMsgPhysicalBySeqReq) (*DeleteMsgPhysicalBySeqResp, error) { return nil, status.Errorf(codes.Unimplemented, "method DeleteMsgPhysicalBySeq not implemented") } +func (*UnimplementedMsgServer) DeleteMsgPhysical(context.Context, *DeleteMsgPhysicalReq) (*DeleteMsgPhysicalResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteMsgPhysical not implemented") +} func (*UnimplementedMsgServer) SetSendMsgStatus(context.Context, *SetSendMsgStatusReq) (*SetSendMsgStatusResp, error) { return nil, status.Errorf(codes.Unimplemented, "method SetSendMsgStatus not implemented") } @@ -3690,6 +3715,24 @@ func _Msg_DeleteMsgPhysicalBySeq_Handler(srv interface{}, ctx context.Context, d return interceptor(ctx, in, info, handler) } +func _Msg_DeleteMsgPhysical_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteMsgPhysicalReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).DeleteMsgPhysical(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/OpenIMServer.msg.msg/DeleteMsgPhysical", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).DeleteMsgPhysical(ctx, req.(*DeleteMsgPhysicalReq)) + } + return interceptor(ctx, in, info, handler) +} + func _Msg_SetSendMsgStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SetSendMsgStatusReq) if err := dec(in); err != nil { @@ -3848,6 +3891,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "DeleteMsgPhysicalBySeq", Handler: _Msg_DeleteMsgPhysicalBySeq_Handler, }, + { + MethodName: "DeleteMsgPhysical", + Handler: _Msg_DeleteMsgPhysical_Handler, + }, { MethodName: "SetSendMsgStatus", Handler: _Msg_SetSendMsgStatus_Handler, diff --git a/pkg/proto/msg/msg.proto b/pkg/proto/msg/msg.proto index 101402ac0..e0568064b 100644 --- a/pkg/proto/msg/msg.proto +++ b/pkg/proto/msg/msg.proto @@ -224,6 +224,8 @@ service msg { rpc DeleteMsgs(DeleteMsgsReq) returns(DeleteMsgsResp); // seq物理删除消息 rpc DeleteMsgPhysicalBySeq(DeleteMsgPhysicalBySeqReq) returns(DeleteMsgPhysicalBySeqResp); + // 物理删除消息by 时间 + rpc DeleteMsgPhysical(DeleteMsgPhysicalReq) returns(DeleteMsgPhysicalResp); //设置消息是否发送成功-针对api发送的消息 rpc SetSendMsgStatus(SetSendMsgStatusReq) returns(SetSendMsgStatusResp);