作者 yangfu

1.推送修改 :透传 赋值payload

... ... @@ -156,7 +156,8 @@ type Result struct {
//透传附加的推送信息
func NewPushInfo(options *push.Options) (v *PushInfo) {
v = &PushInfo{
Aps: NewAps(options),
Aps: NewAps(options),
Payload: options.TransmissionContent,
}
return
}
... ... @@ -165,7 +166,6 @@ func NewAps(options *push.Options) (v *Aps) {
Alert: NewAlert(options),
AutoBadge: "+1",
ContentAvailable: 1,
Payload: options.TransmissionContent,
}
return
}
... ... @@ -178,13 +178,13 @@ func NewAlert(options *push.Options) (v *Alert) {
}
type PushInfo struct {
Aps *Aps `json:"aps"`
Aps *Aps `json:"aps"`
Payload string `json:"payload,omitempty"`
}
type Aps struct {
Alert *Alert `json:"alert"`
AutoBadge string `json:"autoBadge"` //用于计算应用上面未读数字
ContentAvailable int `json:"content-available"` //推送直接带有透传数据 0:有通知栏消息 1:无通知栏消息
Payload string `json:"payload,omitempty"`
}
type Alert struct {
Title string `json:"title"`
... ...