push add ios push

This commit is contained in:
Gordon 2021-12-09 17:14:24 +08:00
parent 3e51e781a6
commit 8085c62774
4 changed files with 17 additions and 2 deletions

View File

@ -23,6 +23,8 @@ func JGAccountListPush(accounts []string, content, detailContent, platform strin
no.SetAlert(content, platform)
var me requestBody.Message
me.SetMsgContent(detailContent)
var o requestBody.Options
o.SetApnsProduction(true)
var po requestBody.PushObj
po.SetPlatform(&pf)
po.SetAudience(&au)

View File

@ -0,0 +1,9 @@
package requestBody
type Options struct {
ApnsProduction bool `json:"apns_production,omitempty"`
}
func (o *Options) SetApnsProduction(c bool) {
o.ApnsProduction = c
}

View File

@ -5,6 +5,7 @@ type PushObj struct {
Audience interface{} `json:"audience"`
Notification interface{} `json:"notification,omitempty"`
Message interface{} `json:"message,omitempty"`
Options interface{} `json:"options,omitempty"`
}
func (p *PushObj) SetPlatform(pf *Platform) {
@ -22,3 +23,6 @@ func (p *PushObj) SetNotification(no *Notification) {
func (p *PushObj) SetMessage(m *Message) {
p.Message = m
}
func (p *PushObj) SetOptions(o *Options) {
p.Options = o
}

View File

@ -98,9 +98,9 @@ func MsgToUser(sendPbData *pbRelay.MsgToUserReq, OfflineInfo string, Options map
}
pushResult, err := push.JGAccountListPush(UIDList, content, jsonCustomContent, constant.PlatformIDToName(t))
if err != nil {
log.NewError(sendPbData.OperationID, "offline push error", sendPbData.String(), err.Error(), t)
log.NewError(sendPbData.OperationID, "offline push error", sendPbData.String(), err.Error(), constant.PlatformIDToName(t))
} else {
log.NewDebug(sendPbData.OperationID, "offline push return result is ", string(pushResult), sendPbData, t)
log.NewDebug(sendPbData.OperationID, "offline push return result is ", string(pushResult), sendPbData, constant.PlatformIDToName(t))
}
}