From 42dc5c1f0f28e8c6a1b8efbb48c8567377081e16 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Wed, 13 Apr 2022 15:21:53 +0800 Subject: [PATCH] getui --- internal/push/getui/push.go | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/internal/push/getui/push.go b/internal/push/getui/push.go index 18197558a..e6db6c273 100644 --- a/internal/push/getui/push.go +++ b/internal/push/getui/push.go @@ -61,14 +61,34 @@ type PushReq struct { Notification Notification `json:"notification,omitempty"` Transmission string `json:"transmission,omitempty"` } `json:"push_message"` + PushChannel struct { + Ios Ios `json:"ios"` + Android Android `json:"android"` + } `json:"push_channel"` +} + +type Ios struct { + Aps struct { + Sound string `json:"sound"` + Alert Alert `json:"alert"` + } `json:"aps"` +} + +type Alert struct { + Title string `json:"title"` + Body string `json:"body"` +} + +type Android struct { + Ups struct { + Notification Notification `json:"notification"` + } `json:"ups"` } type Notification struct { Title string `json:"title"` Body string `json:"body"` ClickType string `json:"click_type"` - //Intent string `json:"intent,omitempty"` - //Url string `json:"url,omitempty"` } type PushResp struct { @@ -102,6 +122,16 @@ func (g *Getui) Push(userIDList []string, alert, detailContent, platform, operat Body: alert, ClickType: "startapp", } + pushReq.PushChannel.Ios.Aps.Sound = "default" + pushReq.PushChannel.Ios.Aps.Alert = Alert{ + Title: alert, + Body: alert, + } + pushReq.PushChannel.Android.Ups.Notification = Notification{ + Title: alert, + Body: alert, + ClickType: "startapp", + } pushResp := PushResp{} err = g.request(PushURL, pushReq, token, &pushResp, operationID) switch err {