|
|
@ -61,14 +61,34 @@ type PushReq struct {
|
|
|
|
Notification Notification `json:"notification,omitempty"`
|
|
|
|
Notification Notification `json:"notification,omitempty"`
|
|
|
|
Transmission string `json:"transmission,omitempty"`
|
|
|
|
Transmission string `json:"transmission,omitempty"`
|
|
|
|
} `json:"push_message"`
|
|
|
|
} `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 {
|
|
|
|
type Notification struct {
|
|
|
|
Title string `json:"title"`
|
|
|
|
Title string `json:"title"`
|
|
|
|
Body string `json:"body"`
|
|
|
|
Body string `json:"body"`
|
|
|
|
ClickType string `json:"click_type"`
|
|
|
|
ClickType string `json:"click_type"`
|
|
|
|
//Intent string `json:"intent,omitempty"`
|
|
|
|
|
|
|
|
//Url string `json:"url,omitempty"`
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type PushResp struct {
|
|
|
|
type PushResp struct {
|
|
|
@ -102,6 +122,16 @@ func (g *Getui) Push(userIDList []string, alert, detailContent, platform, operat
|
|
|
|
Body: alert,
|
|
|
|
Body: alert,
|
|
|
|
ClickType: "startapp",
|
|
|
|
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{}
|
|
|
|
pushResp := PushResp{}
|
|
|
|
err = g.request(PushURL, pushReq, token, &pushResp, operationID)
|
|
|
|
err = g.request(PushURL, pushReq, token, &pushResp, operationID)
|
|
|
|
switch err {
|
|
|
|
switch err {
|
|
|
|