mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-07 10:35:59 +08:00
del msg sync
This commit is contained in:
@@ -2,23 +2,28 @@ package msg
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/constant"
|
||||
"Open_IM/pkg/common/db"
|
||||
"Open_IM/pkg/common/log"
|
||||
commonPb "Open_IM/pkg/proto/sdk_ws"
|
||||
"Open_IM/pkg/utils"
|
||||
"context"
|
||||
"time"
|
||||
)
|
||||
|
||||
func (rpc *rpcChat) DelMsgList(_ context.Context, req *commonPb.DelMsgListReq) (*commonPb.DelMsgListResp, error) {
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String())
|
||||
resp := &commonPb.DelMsgListResp{}
|
||||
if err := db.DB.DelMsgBySeqList(req.UserID, req.SeqList, req.OperationID); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "DelMsg failed", err.Error())
|
||||
resp.ErrMsg = constant.ErrDB.ErrMsg
|
||||
resp.ErrCode = constant.ErrDB.ErrCode
|
||||
select {
|
||||
case rpc.delMsgCh <- deleteMsg{
|
||||
UserID: req.UserID,
|
||||
OpUserID: req.OpUserID,
|
||||
SeqList: req.SeqList,
|
||||
OperationID: req.OperationID,
|
||||
}:
|
||||
case <-time.After(1 * time.Second):
|
||||
resp.ErrCode = constant.ErrSendLimit.ErrCode
|
||||
resp.ErrMsg = constant.ErrSendLimit.ErrMsg
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String())
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user