You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Open-IM-Server/internal/rpc/msg/delete.go

39 lines
1.2 KiB

3 years ago
package msg
import (
"context"
2 years ago
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/tokenverify"
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/msg"
3 years ago
)
2 years ago
func (m *msgServer) DelMsgs(ctx context.Context, req *msg.DelMsgsReq) (*msg.DelMsgsResp, error) {
resp := &msg.DelMsgsResp{}
if _, err := m.MsgDatabase.DelMsgBySeqs(ctx, req.UserID, req.Seqs); err != nil {
2 years ago
return nil, err
3 years ago
}
2 years ago
//DeleteMessageNotification(ctx, req.UserID, req.Seqs)
3 years ago
return resp, nil
}
2 years ago
2 years ago
func (m *msgServer) DelSuperGroupMsg(ctx context.Context, req *msg.DelSuperGroupMsgReq) (*msg.DelSuperGroupMsgResp, error) {
resp := &msg.DelSuperGroupMsgResp{}
2 years ago
if err := tokenverify.CheckAdmin(ctx); err != nil {
return nil, err
}
2 years ago
if err := m.MsgDatabase.DeleteUserSuperGroupMsgsAndSetMinSeq(ctx, req.GroupID, []string{req.UserID}, 0); err != nil {
2 years ago
return nil, err
}
return resp, nil
2 years ago
}
2 years ago
func (m *msgServer) ClearMsg(ctx context.Context, req *msg.ClearMsgReq) (*msg.ClearMsgResp, error) {
2 years ago
resp := &msg.ClearMsgResp{}
if err := tokenverify.CheckAccessV3(ctx, req.UserID); err != nil {
return nil, err
}
2 years ago
if err := m.MsgDatabase.CleanUpUserMsg(ctx, req.UserID); err != nil {
2 years ago
return nil, err
}
2 years ago
return resp, nil
}