first commit
This commit is contained in:
31
service/offline-push/tools/mock/msg.go
Normal file
31
service/offline-push/tools/mock/msg.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package mock
|
||||
|
||||
import (
|
||||
"github.com/golang/protobuf/proto"
|
||||
offlinepush "gitlab.33.cn/chat/dtalk/service/offline-push/api"
|
||||
xproto "gitlab.33.cn/chat/imparse/proto"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Msg struct {
|
||||
AppId string
|
||||
DeviceType offlinepush.Device
|
||||
Nickname string
|
||||
TargetId string
|
||||
DeviceToken string
|
||||
}
|
||||
|
||||
func (m *Msg) Data() ([]byte, error) {
|
||||
//需要推送
|
||||
pushMsg := &offApi.OffPushMsg{
|
||||
AppId: m.AppId,
|
||||
Device: m.DeviceType,
|
||||
Title: m.Nickname,
|
||||
Content: "[你收到一条消息]",
|
||||
Token: m.DeviceToken,
|
||||
ChannelType: int32(xproto.Channel_ToUser),
|
||||
Target: m.TargetId,
|
||||
Timeout: time.Now().Add(time.Minute * 7).Unix(),
|
||||
}
|
||||
return proto.Marshal(pushMsg)
|
||||
}
|
||||
Reference in New Issue
Block a user