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

42 lines
1.2 KiB

3 years ago
package msg
import (
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/log"
3 years ago
pbOffice "Open_IM/pkg/proto/office"
3 years ago
open_im_sdk "Open_IM/pkg/proto/sdk_ws"
3 years ago
"Open_IM/pkg/utils"
3 years ago
"github.com/golang/protobuf/jsonpb"
3 years ago
"github.com/golang/protobuf/proto"
3 years ago
)
3 years ago
func WorkMomentSendNotification(operationID, sendID, recvID string, notificationMsg *pbOffice.WorkMomentNotificationMsg) {
log.NewInfo(operationID, utils.GetSelfFuncName(), recvID)
3 years ago
WorkMomentNotification(operationID, sendID, recvID, notificationMsg)
3 years ago
}
3 years ago
func WorkMomentNotification(operationID, sendID, recvID string, m proto.Message) {
marshaler := jsonpb.Marshaler{
OrigName: true,
EnumsAsInts: false,
EmitDefaults: false,
}
var tips open_im_sdk.TipsComm
var err error
tips.JsonDetail, _ = marshaler.MarshalToString(m)
3 years ago
n := &NotificationMsg{
SendID: sendID,
RecvID: recvID,
MsgFrom: constant.UserMsgType,
ContentType: constant.WorkMomentNotification,
SessionType: constant.UserMsgType,
OperationID: operationID,
3 years ago
}
3 years ago
n.Content, err = proto.Marshal(m)
if err != nil {
log.NewError(operationID, utils.GetSelfFuncName(), "proto marshal falied", err.Error())
return
}
3 years ago
Notification(n)
3 years ago
}