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/push/jpush/requestBody/notification.go

37 lines
788 B

package requestBody
import (
"Open_IM/pkg/common/config"
)
type Notification struct {
3 years ago
Alert string `json:"alert,omitempty"`
Android Android `json:"android,omitempty"`
IOS Ios `json:"ios,omitempty"`
}
type Android struct {
3 years ago
Alert string `json:"alert,omitempty"`
3 years ago
Intent struct {
URL string `json:"url,omitempty"`
} `json:"intent,omitempty"`
}
type Ios struct {
Alert string `json:"alert,omitempty"`
Sound string `json:"sound,omitempty"`
Badge string `json:"badge,omitempty"`
}
3 years ago
func (n *Notification) SetAlert(alert string) {
n.Alert = alert
3 years ago
n.Android.Alert = alert
n.SetAndroidIntent()
n.IOS.Alert = alert
n.IOS.Sound = "default"
n.IOS.Badge = "+1"
}
func (n *Notification) SetAndroidIntent() {
3 years ago
n.Android.Intent.URL = config.Config.Push.Jpns.PushIntent
}