Files
open-im-server/internal/rpc/msg/work_moments_notification.go
T

32 lines
925 B
Go
Raw Normal View History

2022-04-18 19:24:36 +08:00
package msg
import (
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/log"
2022-04-20 16:25:33 +08:00
pbOffice "Open_IM/pkg/proto/office"
2022-04-18 19:24:36 +08:00
"Open_IM/pkg/utils"
2022-04-20 16:25:33 +08:00
"github.com/golang/protobuf/proto"
2022-04-18 19:24:36 +08:00
)
2022-04-20 16:25:33 +08:00
func WorkMomentSendNotification(operationID, sendID, recvID string, notificationMsg *pbOffice.WorkMomentNotificationMsg) {
log.NewInfo(operationID, utils.GetSelfFuncName(), recvID)
bytes, err := proto.Marshal(notificationMsg)
2022-04-18 19:24:36 +08:00
if err != nil {
2022-04-20 16:25:33 +08:00
log.NewError(operationID, utils.GetSelfFuncName(), "proto marshal failed", err.Error())
2022-04-18 19:24:36 +08:00
}
2022-04-20 16:25:33 +08:00
WorkMomentNotification(operationID, sendID, recvID, bytes)
}
func WorkMomentNotification(operationID, sendID, recvID string, content []byte) {
n := &NotificationMsg{
SendID: sendID,
RecvID: recvID,
Content: content,
MsgFrom: constant.UserMsgType,
ContentType: constant.WorkMomentNotification,
SessionType: constant.UserMsgType,
OperationID: operationID,
2022-04-18 19:24:36 +08:00
}
2022-04-20 16:25:33 +08:00
Notification(n)
2022-04-18 19:24:36 +08:00
}