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

44 lines
1.2 KiB

3 years ago
package msg
import (
2 years ago
"Open_IM/pkg/common/tokenverify"
"Open_IM/pkg/proto/msg"
2 years ago
common "Open_IM/pkg/proto/sdkws"
3 years ago
"context"
)
2 years ago
func (m *msgServer) DelMsgList(ctx context.Context, req *common.DelMsgListReq) (*common.DelMsgListResp, error) {
2 years ago
resp := &common.DelMsgListResp{}
2 years ago
if err := m.MsgInterface.DelMsgFromCache(ctx, req.UserID, req.SeqList); err != nil {
2 years ago
return nil, err
3 years ago
}
2 years ago
DeleteMessageNotification(ctx, req.UserID, req.SeqList)
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
maxSeq, err := m.MsgInterface.GetGroupMaxSeq(ctx, req.GroupID)
if err != nil {
2 years ago
return nil, err
}
2 years ago
if err := m.MsgInterface.SetGroupUserMinSeq(ctx, req.GroupID, maxSeq); 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.MsgInterface.DelUserAllSeq(ctx, req.UserID); err != nil {
2 years ago
return nil, err
}
2 years ago
return resp, nil
}