diff --git a/jPush/push.go b/jPush/push.go index 5d932f3..e4fbd6d 100644 --- a/jPush/push.go +++ b/jPush/push.go @@ -6,12 +6,12 @@ import ( ) // 极光推送 最大1000个用户 -func PushMoreUser(key, secret, title, content string, alias []string, extras map[string]interface{}) (map[string]interface{}, error) { +func PushMoreUser(key, secret, title, content string, platform string, alias []string, extras map[string]interface{}) (map[string]interface{}, error) { var client = jpush.NewClient(key, secret) audience := &jpush.PushAudience{ Alias: alias, } - req := getMsg(title, content, audience, extras) + req := getMsg(title, content, platform, audience, extras) result, err := client.Push(req) if err != nil { return nil, err @@ -20,10 +20,10 @@ func PushMoreUser(key, secret, title, content string, alias []string, extras map } // 广播推送 一天10次 -func PushAllUser(key, secret, title, content string, extras map[string]interface{}) (map[string]interface{}, error) { +func PushAllUser(key, secret, title, content string, platform string, extras map[string]interface{}) (map[string]interface{}, error) { var client = jpush.NewClient(key, secret) audience := "all" - req := getMsg(title, content, audience, extras) + req := getMsg(title, content, platform, audience, extras) result, err := client.Push(req) if err != nil { fmt.Println(err) @@ -32,9 +32,9 @@ func PushAllUser(key, secret, title, content string, extras map[string]interface fmt.Println(result) return result, nil } -func getMsg(title, content string, audience interface{}, extras map[string]interface{}) *jpush.PushRequest { +func getMsg(title, content string, platform string, audience interface{}, extras map[string]interface{}) *jpush.PushRequest { req := &jpush.PushRequest{ - Platform: "all", + Platform: jpush.Platform(platform), Audience: audience, Notification: &jpush.PushNotification{ Alert: content,