push update

This commit is contained in:
Gordon
2022-04-13 16:20:30 +08:00
parent d670356388
commit 6449c4a53d
6 changed files with 69 additions and 81 deletions
+3 -3
View File
@@ -32,13 +32,13 @@ func (j *JPush) SetAlias(cid, alias string) (resp string, err error) {
return resp, nil
}
func (j *JPush) Push(accounts []string, alert, detailContent, platform, operationID string) (string, error) {
func (j *JPush) Push(accounts []string, alert, detailContent, operationID string) (string, error) {
var pf requestBody.Platform
_ = pf.SetPlatform(platform)
pf.SetAll()
var au requestBody.Audience
au.SetAlias(accounts)
var no requestBody.Notification
no.SetAlert(alert, platform)
no.SetAlert(alert)
var me requestBody.Message
me.SetMsgContent(detailContent)
var o requestBody.Options
@@ -2,7 +2,6 @@ package requestBody
import (
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant"
)
type Notification struct {
@@ -23,18 +22,14 @@ type Ios struct {
Badge string `json:"badge,omitempty"`
}
func (n *Notification) SetAlert(alert, platform string) {
func (n *Notification) SetAlert(alert string) {
n.Alert = alert
switch platform {
case constant.AndroidPlatformStr:
n.Android.Alert = alert
n.SetAndroidIntent()
case constant.IOSPlatformStr:
n.IOS.Alert = alert
n.IOS.Sound = "default"
n.IOS.Badge = "+1"
default:
}
n.Android.Alert = alert
n.SetAndroidIntent()
n.IOS.Alert = alert
n.IOS.Sound = "default"
n.IOS.Badge = "+1"
}
func (n *Notification) SetAndroidIntent() {
n.Android.Intent.URL = config.Config.Push.Jpns.PushIntent