Example #1
0
class WiFiConnectedEvent(BaseEvent):
    event = "wificconnected"
    connect_time = IntegerField("ConnectTime")
    expire_time = IntegerField("ExpireTime")
    vendor_id = StringField("VendorId")
    shop_id = StringField("PlaceId")
    bssid = StringField("DeviceNo")
Example #2
0
class DeviceUnbindEvent(BaseEvent):
    event = "device_unbind"
    device_type = StringField("DeviceType")
    device_id = StringField("DeviceID")
    session_id = StringField("SessionID")
    content = Base64DecodeField("Content")
    open_id = StringField("OpenID")
Example #3
0
class DeviceEventReply(BaseReply):
    type = "device_event"
    event = StringField("Event")
    device_type = StringField("DeviceType")
    device_id = StringField("DeviceID")
    session_id = StringField("SessionID")
    content = Base64EncodeField("Content")
Example #4
0
class ViewMiniProgramEvent(BaseEvent):
    """
    从菜单进入小程序事件
    """

    event = "view_miniprogram"
    page_path = StringField("EventKey")  # 小程序路径
    menu_id = StringField("MenuId")  # 菜单ID
Example #5
0
class ImageMessage(BaseMessage):
    """
    图片消息
    详情请参阅
    https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Receiving_standard_messages.html
    """

    type = "image"
    media_id = StringField("MediaId")
    image = StringField("PicUrl")
Example #6
0
class VideoMessage(BaseMessage):
    """
    视频消息
    详情请参阅
    https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Receiving_standard_messages.html
    """

    type = "video"
    media_id = StringField("MediaId")
    thumb_media_id = StringField("ThumbMediaId")
Example #7
0
class ComponentUpdateAuthorizedMessage(BaseComponentMessage):
    """
    更新授权通知
    """

    type = "updateauthorized"
    authorizer_appid = StringField("AuthorizerAppid")
    authorization_code = StringField("AuthorizationCode")
    authorization_code_expired_time = StringField("AuthorizationCodeExpiredTime")
    pre_auth_code = StringField("PreAuthCode")
Example #8
0
class UserScanProductEnterSessionEvent(BaseEvent):
    """
    进入公众号事件

    详情请参考
    https://mp.weixin.qq.com/wiki?id=mp1455872179
    """

    event = "user_scan_product_enter_session"
    standard = StringField("KeyStandard")
    key = StringField("KeyStr")
Example #9
0
class SubmitMembercardUserInfo(BaseEvent):
    """
    会员卡激活事件推送

    详情请参阅
    https://developers.weixin.qq.com/doc/offiaccount/Cards_and_Offer/Coupons_Vouchers_and_Cards_Event_Push_Messages.html#12
    """

    event = "submit_membercard_user_info"
    card_id = StringField("CardId")
    card_code = StringField("UserCardCode")
Example #10
0
class CardSkuRemindEvent(BaseEvent):
    """
    卡券库存报警事件

    详情请参阅
    https://developers.weixin.qq.com/doc/offiaccount/Cards_and_Offer/Coupons_Vouchers_and_Cards_Event_Push_Messages.html#10
    """

    event = "card_sku_remind"
    card_id = StringField("CardId")
    detail = StringField("Detail")
Example #11
0
class ScanEvent(BaseEvent):
    """
    用户扫描二维码事件

    详情请参阅
    https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Receiving_event_pushes.html
    """

    event = "scan"
    scene_id = StringField("EventKey")
    ticket = StringField("Ticket")
Example #12
0
class UserDeleteCardEvent(BaseEvent):
    """
    卡券删除事件推送

    详情请参阅
    https://developers.weixin.qq.com/doc/offiaccount/Cards_and_Offer/Coupons_Vouchers_and_Cards_Event_Push_Messages.html#4
    """

    event = "user_del_card"
    card_id = StringField("CardId")
    code = StringField("UserCardCode")
Example #13
0
class UserEnterSessionFromCardEvent(BaseEvent):
    """
    从卡券进入公众号会话事件推送

    详情请参阅
    https://developers.weixin.qq.com/doc/offiaccount/Cards_and_Offer/Coupons_Vouchers_and_Cards_Event_Push_Messages.html#8
    """

    event = "user_enter_session_from_card"
    card_id = StringField("CardId")
    code = StringField("UserCardCode")
Example #14
0
class VoiceMessage(BaseMessage):
    """
    语音消息
    详情请参阅
    https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Receiving_standard_messages.html
    """

    type = "voice"
    media_id = StringField("MediaId")
    format = StringField("Format")
    recognition = StringField("Recognition")
Example #15
0
class LinkMessage(BaseMessage):
    """
    链接消息
    详情请参阅
    https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Receiving_standard_messages.html
    """

    type = "link"
    title = StringField("Title")
    description = StringField("Description")
    url = StringField("Url")
Example #16
0
class UserViewCard(BaseEvent):
    """
    进入会员卡事件推送

    详情请参阅
    https://developers.weixin.qq.com/doc/offiaccount/Cards_and_Offer/Coupons_Vouchers_and_Cards_Event_Push_Messages.html#7
    """

    event = "user_view_card"
    card_id = StringField("CardId")
    code = StringField("UserCardCode")
    outer_str = StringField("OuterStr")
Example #17
0
class TaskCardClickEvent(events.BaseEvent):
    """
    任务卡片事件推送

    详情请参阅
    https://work.weixin.qq.com/api/doc/90000/90135/90240#%E4%BB%BB%E5%8A%A1%E5%8D%A1%E7%89%87%E4%BA%8B%E4%BB%B6%E6%8E%A8%E9%80%81
    """

    event = "taskcard_click"
    event_key = StringField("EventKey")
    agent = IntegerField("AgentID", 0)
    task_id = StringField("TaskId")
Example #18
0
class UpdateInvoiceStatusEvent(BaseEvent):
    """
    发票状态更新事件

    详情请参考
    https://mp.weixin.qq.com/wiki?id=mp1497082828_r1cI2
    """

    event = "update_invoice_status"
    status = StringField("Status")  # 发票报销状态
    card_id = StringField("CardId")  # 发票 Card ID
    code = StringField("Code")  # 发票 Code
Example #19
0
class UserScanProductAsyncEvent(BaseEvent):
    """
    地理位置信息异步推送事件

    详情请参考
    https://mp.weixin.qq.com/wiki?id=mp1455872179
    """

    event = "user_scan_product_async"
    standard = StringField("KeyStandard")
    key = StringField("KeyStr")
    region_code = StringField("RegionCode")
Example #20
0
class UserScanProductVerifyActionEvent(BaseEvent):
    """
    商品审核结果事件

    详情请参考
    https://mp.weixin.qq.com/wiki?id=mp1455872179
    """

    event = "user_scan_product_verify_action"
    standard = StringField("KeyStandard")
    key = StringField("KeyStr")
    result = StringField("Result")
    reason = StringField("ReasonMsg")
Example #21
0
class UpdateMemberCard(BaseEvent):
    """
    会员卡内容更新事件

    详情请参阅
    https://developers.weixin.qq.com/doc/offiaccount/Cards_and_Offer/Coupons_Vouchers_and_Cards_Event_Push_Messages.html#9
    """

    event = "update_member_card"
    card_id = StringField("CardId")
    code = StringField("UserCardCode")
    modify_bonus = IntegerField("ModifyBonus")
    modify_balance = IntegerField("ModifyBalance")
Example #22
0
class MiniProgramPageMessage(BaseMessage):
    """
    小程序卡片消息
    详情请参阅
    https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/customer-message/receive.html#小程序卡片消息
    """

    type = "miniprogrampage"
    app_id = StringField("AppId")
    title = StringField("Title")
    page_path = StringField("PagePath")
    thumb_url = StringField("ThumbUrl")
    thumb_media_id = StringField("ThumbMediaId")
Example #23
0
class ChangeExternalContactEvent(events.BaseEvent):
    """
    外部联系人事件

    详情请参阅
    https://work.weixin.qq.com/api/doc/90000/90135/92130#%E6%B7%BB%E5%8A%A0%E5%A4%96%E9%83%A8%E8%81%94%E7%B3%BB%E4%BA%BA%E4%BA%8B%E4%BB%B6
    """

    event = "change_external_contact"
    change_type = StringField("ChangeType")
    welcome_code = StringField("WelcomeCode")
    state = StringField("State")
    user_id = StringField("UserID")
    external_user_id = StringField("ExternalUserID")
Example #24
0
class UserGiftingCardEvent(BaseEvent):
    """
    转赠事件推送

    详情请参阅
    https://developers.weixin.qq.com/doc/offiaccount/Cards_and_Offer/Coupons_Vouchers_and_Cards_Event_Push_Messages.html#3
    """

    event = "user_gifting_card"
    card_id = StringField("CardId")
    code = StringField("UserCardCode")
    is_return_back = IntegerField("IsReturnBack")
    friend = StringField("FriendUserName")
    is_chat_room = IntegerField("IsChatRoom")
Example #25
0
class UserAuthorizeInvoiceEvent(BaseEvent):
    """
    用户授权发票事件
    (会包含一个订单号,不成功就失败)

    详情请参考
    https://mp.weixin.qq.com/wiki?id=mp1497082828_r1cI2
    """

    event = "user_authorize_invoice"
    success_order_id = StringField("SuccOrderId")  # 授权成功的订单号
    fail_order_id = StringField("FailOrderId")  # 授权失败的订单号
    app_id = StringField("AppId")  # 用于接收事件推送的公众号的AppId
    auth_source = StringField("Source")  # 授权来源,web表示来自微信内H5,app标识来自app
Example #26
0
class UserPayFromPayCell(BaseEvent):
    """
    卡券买单事件推送

    详情请参阅
    https://developers.weixin.qq.com/doc/offiaccount/Cards_and_Offer/Coupons_Vouchers_and_Cards_Event_Push_Messages.html#6
    """

    event = "user_pay_from_pay_cell"
    card_id = StringField("CardId")
    code = StringField("UserCardCode")
    trans_id = StringField("TransId")
    location_id = IntegerField("LocationId")
    fee = IntegerField("Fee")
    original_fee = IntegerField("OriginalFee")
Example #27
0
class BaseMessage(metaclass=MessageMetaClass):
    """Base class for all messages and events"""

    type = "unknown"
    id = IntegerField("MsgId", 0)
    source = StringField("FromUserName")
    target = StringField("ToUserName")
    create_time = DateTimeField("CreateTime")
    time = IntegerField("CreateTime")

    def __init__(self, message):
        self._data = message

    def __repr__(self):
        return f"{self.__class__.__name__}({repr(self._data)})"
Example #28
0
class ComponentUnauthorizedMessage(BaseComponentMessage):
    """
    取消授权通知
    """

    type = "unauthorized"
    authorizer_appid = StringField("AuthorizerAppid")
Example #29
0
class LocationMessage(BaseMessage):
    """
    地理位置消息
    详情请参阅
    https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Receiving_standard_messages.html
    """

    type = "location"
    location_x = StringField("Location_X")
    location_y = StringField("Location_Y")
    scale = StringField("Scale")
    label = StringField("Label")

    @property
    def location(self):
        return self.location_x, self.location_y
Example #30
0
class ComponentVerifyTicketMessage(BaseComponentMessage):
    """
    component_verify_ticket协议
    """

    type = "component_verify_ticket"
    verify_ticket = StringField("ComponentVerifyTicket")