diff --git a/internal/push/jpush/push.go b/internal/push/jpush/push.go index 03827d9e9..e5ce9b4ac 100644 --- a/internal/push/jpush/push.go +++ b/internal/push/jpush/push.go @@ -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) diff --git a/internal/push/jpush/requestBody/options.go b/internal/push/jpush/requestBody/options.go new file mode 100644 index 000000000..97a452fad --- /dev/null +++ b/internal/push/jpush/requestBody/options.go @@ -0,0 +1,9 @@ +package requestBody + +type Options struct { + ApnsProduction bool `json:"apns_production,omitempty"` +} + +func (o *Options) SetApnsProduction(c bool) { + o.ApnsProduction = c +} diff --git a/internal/push/jpush/requestBody/pushObj.go b/internal/push/jpush/requestBody/pushObj.go index 24c912b26..974161407 100644 --- a/internal/push/jpush/requestBody/pushObj.go +++ b/internal/push/jpush/requestBody/pushObj.go @@ -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 +} diff --git a/internal/push/logic/push_to_client.go b/internal/push/logic/push_to_client.go index 1e8d3acd3..b7c8c94af 100644 --- a/internal/push/logic/push_to_client.go +++ b/internal/push/logic/push_to_client.go @@ -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)) } }