def TransmissionTemplateDemo(): template = TransmissionTemplate() template.transmissionType = 1 template.appId = APPID template.appKey = APPKEY template.transmissionContent = '请填入透传内容' # iOS 推送需要的PushInfo字段 前三项必填,后四项可以填空字符串 # template.setPushInfo(actionLocKey, badge, message, sound, payload, locKey, locArgs, launchImage) # template.setPushInfo("", 0, "", "com.gexin.ios.silence", "", "", "", ""); # APN简单推送 alertMsg = SimpleAlertMsg() alertMsg.alertMsg = "" apn = APNPayload(); apn.alertMsg = alertMsg apn.badge = 2 # apn.sound = "" apn.addCustomMsg("payload", "payload") # apn.contentAvailable=1 # apn.category="ACTIONABLE" template.setApnInfo(apn) # APN高级推送 # apnpayload = APNPayload() # apnpayload.badge = 4 # apnpayload.sound = "com.gexin.ios.silence" # apnpayload.addCustomMsg("payload", "payload") # # apnpayload.contentAvailable = 1 # # apnpayload.category = "ACTIONABLE" # alertMsg = DictionaryAlertMsg() # alertMsg.body = 'body' # alertMsg.actionLocKey = 'actionLockey' # alertMsg.locKey = 'lockey' # alertMsg.locArgs=['locArgs'] # alertMsg.launchImage = 'launchImage' # # IOS8.2以上版本支持 # # alertMsg.title = 'Title' # # alertMsg.titleLocArgs = ['TitleLocArg'] # # alertMsg.titleLocKey = 'TitleLocKey' # apnpayload.alertMsg=alertMsg # template.setApnInfo(apnpayload) return template
def pushAPN(): push = IGeTui(HOST, APPKEY, MASTERSECRET) message = IGtSingleMessage() # APN旧版推送Demo # template = APNTemplate() # template.setPushInfo("", -1,"", "", "", "", "", "") # APN简单推送 template = APNTemplate() apn = APNPayload(); alertMsg = SimpleAlertMsg() alertMsg.alertMsg = "" apn.alertMsg = alertMsg apn.badge = 2 apn.sound = "" apn.addCustomMsg("payload", "payload") # apn.contentAvailable=1 # apn.category="ACTIONABLE" template.setApnInfo(apn) # APN高级推送 # template = APNTemplate() # apnpayload = APNPayload() # apnpayload.badge = 4 # apnpayload.sound = "sound" # apnpayload.addCustomMsg("payload", "payload") # # apnpayload.contentAvailable = 1 # # apnpayload.category = "ACTIONABLE" # # # alertMsg = DictionaryAlertMsg() # alertMsg.body = 'body' # alertMsg.actionLocKey = 'actionLockey' # alertMsg.locKey = 'lockey' # alertMsg.locArgs=['locArgs'] # alertMsg.launchImage = 'launchImage' # # IOS8.2以上版本支持 # # alertMsg.title = 'Title' # # alertMsg.titleLocArgs = ['TitleLocArg'] # # alertMsg.titleLocKey = 'TitleLocKey' # apnpayload.alertMsg=alertMsg # template.setApnInfo(apnpayload) # 单个用户推送接口 message.data = template ret = push.pushAPNMessageToSingle(APPID, DEVICETOKEN, message) print message print ret
def TransmissionTemplateDemo(order_no): template = TransmissionTemplate() template.transmissionType = 2 template.appId = AppID template.appKey = AppKey template.transmissionContent = '订单来啦' # iOS 推送需要的PushInfo字段 前三项必填,后四项可以填空字符串 # template.setPushInfo(actionLocKey, badge, message, sound, payload, locKey, locArgs, launchImage) # template.setPushInfo("", 0, "", "com.gexin.ios.silence", "", "", "", ""); # APN简单推送 alertMsg = SimpleAlertMsg() alertMsg.alertMsg = '订单来啦' apn = APNPayload() apn.alertMsg = alertMsg apn.badge = 1 # apn.sound = "" apn.addCustomMsg("payload", "payload") # apn.contentAvailable=1 # apn.category="ACTIONABLE" template.setApnInfo(apn) # APN高级推送 # apnpayload = APNPayload() # apnpayload.badge = 4 # apnpayload.sound = "com.gexin.ios.silence" # apnpayload.addCustomMsg("payload", "payload") # # apnpayload.contentAvailable = 1 # # apnpayload.category = "ACTIONABLE" # alertMsg = DictionaryAlertMsg() # alertMsg.body = 'body' # alertMsg.actionLocKey = 'actionLockey' # alertMsg.locKey = 'lockey' # alertMsg.locArgs=['locArgs'] # alertMsg.launchImage = 'launchImage' # # IOS8.2以上版本支持 # # alertMsg.title = 'Title' # # alertMsg.titleLocArgs = ['TitleLocArg'] # # alertMsg.titleLocKey = 'TitleLocKey' # apnpayload.alertMsg=alertMsg # template.setApnInfo(apnpayload) return template