Example #1
0
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