2022-03-16 18:02:26 +08:00
|
|
|
package msg
|
|
|
|
|
|
|
|
|
|
import (
|
2023-02-23 19:15:30 +08:00
|
|
|
"OpenIM/pkg/common/tokenverify"
|
|
|
|
|
"OpenIM/pkg/proto/msg"
|
2022-03-16 18:02:26 +08:00
|
|
|
"context"
|
|
|
|
|
)
|
|
|
|
|
|
2023-03-03 17:42:26 +08:00
|
|
|
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 {
|
2023-02-13 11:24:13 +08:00
|
|
|
return nil, err
|
2022-03-17 19:00:05 +08:00
|
|
|
}
|
2023-03-03 18:44:14 +08:00
|
|
|
//DeleteMessageNotification(ctx, req.UserID, req.Seqs)
|
2022-03-16 18:02:26 +08:00
|
|
|
return resp, nil
|
|
|
|
|
}
|
2023-02-13 11:24:13 +08:00
|
|
|
|
2023-02-13 18:14:26 +08:00
|
|
|
func (m *msgServer) DelSuperGroupMsg(ctx context.Context, req *msg.DelSuperGroupMsgReq) (*msg.DelSuperGroupMsgResp, error) {
|
2022-07-29 12:24:54 +08:00
|
|
|
resp := &msg.DelSuperGroupMsgResp{}
|
2023-02-13 11:24:13 +08:00
|
|
|
if err := tokenverify.CheckAdmin(ctx); err != nil {
|
|
|
|
|
return nil, err
|
2022-07-29 12:24:54 +08:00
|
|
|
}
|
2023-02-24 11:01:33 +08:00
|
|
|
if err := m.MsgDatabase.DeleteUserSuperGroupMsgsAndSetMinSeq(ctx, req.GroupID, []string{req.UserID}, 0); err != nil {
|
2023-02-13 11:24:13 +08:00
|
|
|
return nil, err
|
2022-07-29 12:24:54 +08:00
|
|
|
}
|
|
|
|
|
return resp, nil
|
2023-01-11 16:23:16 +08:00
|
|
|
}
|
2023-02-10 22:10:37 +08:00
|
|
|
|
2023-02-13 18:14:26 +08:00
|
|
|
func (m *msgServer) ClearMsg(ctx context.Context, req *msg.ClearMsgReq) (*msg.ClearMsgResp, error) {
|
2023-02-13 11:24:13 +08:00
|
|
|
resp := &msg.ClearMsgResp{}
|
|
|
|
|
if err := tokenverify.CheckAccessV3(ctx, req.UserID); err != nil {
|
|
|
|
|
return nil, err
|
2023-02-10 22:10:37 +08:00
|
|
|
}
|
2023-02-24 11:01:33 +08:00
|
|
|
if err := m.MsgDatabase.CleanUpUserMsg(ctx, req.UserID); err != nil {
|
2023-02-13 11:24:13 +08:00
|
|
|
return nil, err
|
2023-02-10 22:10:37 +08:00
|
|
|
}
|
2023-02-13 11:24:13 +08:00
|
|
|
return resp, nil
|
2023-02-10 22:10:37 +08:00
|
|
|
}
|