From e780dc13bff89d67aa19cdf028c2265cb1d5b892 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Mon, 25 Nov 2024 14:28:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9E=81=E5=85=89=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jPush/push.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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,