Exemple #1
0
class NoNameMessage(object):
    test_int = IntEntry("TestInt")
    test_string_to_int = IntEntry("TestStringToInt")
    test_float_to_int = IntEntry("TestFloatToInt")
    test_int_none = IntEntry("MIAOMIAOMIAO")

    test_float = FloatEntry("TestFloat")
    test_string_to_float = FloatEntry("TestStringToFloat")
    test_float_none = FloatEntry("WANGWANG")

    test_string = StringEntry("TestString")
    test_int_to_string = StringEntry("TestIntToString")
    test_float_to_string = StringEntry("TestFloatToString")
    test_chinese = StringEntry("TestChinese")
    test_string_none = StringEntry("HAHAHA")

    def __init__(self):
        message = {
            "TestInt": 123,
            "TestFloat": 0.00001,
            "TestString": "hello",
            "TestStringToInt": "123",
            "TestFloatToInt": 123.000,
            "TestStringToFloat": "0.00001",
            "TestIntToString": 123,
            "TestFloatToString": 0.00001,
            "TestChinese": "喵",
        }
        self.__dict__.update(message)
Exemple #2
0
class UserScanProductEvent(BaseProductEvent):
    __type__ = 'user_scan_product_event'
    country = StringEntry('Country')
    province = StringEntry('Province')
    city = StringEntry('City')
    sex = IntEntry('Sex')
    scene = IntEntry('Scene')
Exemple #3
0
class WeChatEvent(object):
    target = StringEntry('ToUserName')
    source = StringEntry('FromUserName')
    time = IntEntry('CreateTime')
    message_id = IntEntry('MsgID', 0)

    def __init__(self, message):
        self.__dict__.update(message)
Exemple #4
0
class WeChatMessage(object, metaclass=MessageMetaClass):
    message_id = IntEntry('MsgId', 0)
    target = StringEntry('ToUserName')
    source = StringEntry('FromUserName')
    time = IntEntry('CreateTime', 0)

    def __init__(self, message):
        self.__dict__.update(message)
Exemple #5
0
class UserGetCardEvent(BaseCardEvent):
    __type__ = 'user_get_card_event'
    is_give_by_friend = IntEntry('IsGiveByFriend')
    friend_user_name = StringEntry('FriendUserName')
    outer_id = IntEntry('OuterId')
    old_user_card_code = StringEntry('OldUserCardCode')
    outer_str = StringEntry('OuterStr')
    is_restore_member_card = IntEntry('IsRestoreMemberCard')
    is_recommend_by_friend = IntEntry('IsRecommendByFriend')
Exemple #6
0
class CardPayOrderEvent(WeChatEvent):
    __type__ = 'card_pay_order_event'
    order_id = StringEntry('OrderId')
    status = StringEntry('Status')
    create_order_time = IntEntry('CreateOrderTime')
    pay_finish_time = IntEntry('PayFinishTime')
    desc = StringEntry('Desc')
    free_coin_count = StringEntry('FreeCoinCount')
    pay_coin_count = StringEntry('PayCoinCount')
    refund_free_coin_count = StringEntry('RefundFreeCoinCount')
    refund_pay_coin_count = StringEntry('RefundPayCoinCount')
    order_type = StringEntry('OrderType')
    memo = StringEntry('Memo')
    receipt_info = StringEntry('ReceiptInfo')
Exemple #7
0
class LocationMessage(WeChatMessage):
    __type__ = 'location'
    location_x = FloatEntry('Location_X')
    location_y = FloatEntry('Location_Y')
    label = StringEntry('Label')
    scale = IntEntry('Scale')

    @property
    def location(self):
        return self.location_x, self.location_y
Exemple #8
0
class BasePicEvent(SimpleEvent):
    count = IntEntry('SendPicsInfo.Count')

    def __init__(self, message):
        super(BasePicEvent, self).__init__(message)
        self.pic_list = list()
        if self.count > 1:
            for item in message['SendPicsInfo']['PicList'].pop('item'):
                self.pic_list.append({'pic_md5_sum': item['PicMd5Sum']})
        else:
            self.pic_list.append(
                {'pic_md5_sum': message['SendPicsInfo']['PicList'].pop('item')['PicMd5Sum']}
            )
Exemple #9
0
class UpdateMemberCardEvent(BaseCardEvent):
    __type__ = 'update_member_card_event'
    modify_bonus = IntEntry('ModifyBonus')
    modify_balance = IntEntry('ModifyBalance')
Exemple #10
0
class UserPayFromPayCellEvent(BaseCardEvent):
    __type__ = 'user_pay_from_pay_cell_event'
    trans_id = StringEntry('TransId')
    location_id = IntEntry('LocationId')
    fee = StringEntry('Fee')
    original_fee = StringEntry('OriginalFee')
Exemple #11
0
class UserGiftingCardEvent(BaseCardEvent):
    __type__ = 'user_gifting_card_event'
    is_return_back = IntEntry('IsReturnBack')
    friend_user_name = StringEntry('FriendUserName')
    is_chat_room = IntEntry('IsChatRoom')