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/msg_status.go

30 lines
947 B

2 years ago
package msg
import (
"context"
2 years ago
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant"
2 years ago
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/mcontext"
2 years ago
pbMsg "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/msg"
2 years ago
)
2 years ago
func (m *msgServer) SetSendMsgStatus(ctx context.Context, req *pbMsg.SetSendMsgStatusReq) (*pbMsg.SetSendMsgStatusResp, error) {
2 years ago
resp := &pbMsg.SetSendMsgStatusResp{}
2 years ago
if err := m.MsgDatabase.SetSendMsgStatus(ctx, mcontext.GetOperationID(ctx), req.Status); err != nil {
2 years ago
return nil, err
2 years ago
}
return resp, nil
}
2 years ago
func (m *msgServer) GetSendMsgStatus(ctx context.Context, req *pbMsg.GetSendMsgStatusReq) (*pbMsg.GetSendMsgStatusResp, error) {
2 years ago
resp := &pbMsg.GetSendMsgStatusResp{}
2 years ago
status, err := m.MsgDatabase.GetSendMsgStatus(ctx, mcontext.GetOperationID(ctx))
2 years ago
if IsNotFound(err) {
resp.Status = constant.MsgStatusNotExist
return resp, nil
} else if err != nil {
2 years ago
return nil, err
2 years ago
}
2 years ago
resp.Status = status
2 years ago
return resp, nil
}