123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204 |
- class WXBean(object):
- def __repr__(self):
- result = self.__class__.__name__ + "\n"
- for key in self.__dir__():
- if not key.startswith('__'):
- value = getattr(self, key)
- if not callable(value):
- result += " " + key + " = " + str(value) + "\n"
- return result
- @classmethod
- def build_from(cls, obj: {}):
- bean = cls()
- for key in obj:
- if len(key) > 0:
- value = obj[key]
- setattr(bean, key, value)
- return bean
- class WXUserMsg(WXBean):
- URL: str
- ToUserName: str
- FromUserName: str
- CreateTime: int
- MsgType: str
- Content: str
- MsgId: int
- class WXMenu(WXBean):
- obj: {}
- def __init__(self):
- self.obj = {
- "button": []
- }
- def add_click_button(self, text: str, key: str):
- temp = {
- "type": "click",
- "name": text,
- "key": key,
- }
- self.obj["button"].append(temp)
- def add_view_button(self, text: str, url: str):
- temp = {
- "type": "view",
- "name": text,
- "url": url,
- }
- self.obj["button"].append(temp)
- class UserRequest(WXBean):
- user_name: str
- is_man: bool
- date_mode: int
- born_year: int
- born_month: int
- born_day: int
- know_time: int
- born_hour: int
- born_minute: int
- born_sheng: str
- born_shi: str
- born_qu: str
- open_id: str
- class LoginRequest(WXBean):
- account: str
- password: str
- userAgent: str
- screenResolution: str
- colorDepth: str
- timezoneOffset: str
- language: str
- class GetSiZhuRequest(WXBean):
- uid: int
- token: str
- isMan: bool
- year: int
- month: int
- day: int
- hourMode: int
- hour: int
- minute: int
- areaMode: int
- sheng: str
- shi: str
- qu: str
- def __init__(self):
- self.hour = None
- self.minute = None
- self.sheng = "未知地区"
- self.shi = "-"
- self.qu = "-"
- def fix_data(self):
- if self.hour is None or self.minute is None:
- self.hour = None
- self.minute = None
- class CalcNongLiRequest(WXBean):
- year: int
- month: str
- day: str
- class GetSiZhuByNongLiRequest(WXBean):
- uid: int
- token: str
- isMan: bool
- year: int
- month: str
- day: str
- hourMode: int
- hour: int
- minute: int
- areaMode: int
- sheng: str
- shi: str
- qu: str
- def __init__(self):
- self.hour = None
- self.minute = None
- self.sheng = "未知地区"
- self.shi = "-"
- self.qu = "-"
- def fix_data(self):
- if self.hour is None or self.minute is None:
- self.hour = None
- self.minute = None
- class GetSiZhuByTextsRequest(WXBean):
- uid: int
- token: str
- isMan: bool
- niangan: str
- nianzhi: str
- yuegan: str
- yuezhi: str
- rigan: str
- rizhi: str
- shigan: str
- shizhi: str
- ignoreError: bool
- class SaveUserRequest(WXBean):
- name: str
- isMan: bool
- dateMode: int
- year: int = None
- month: str = None
- day: str = None
- hourMode: int = None
- hour: int = None
- minute: int = None
- areaMode: int = None
- sheng: str = None
- shi: str = None
- qu: str = None
- extra: str = None
- nongli_year: int = None
- nongli_month: str = None
- nongli_day: str = None
- req_nian_gan: str = None
- req_nian_zhi: str = None
- req_yue_gan: str = None
- req_yue_zhi: str = None
- req_ri_gan: str = None
- req_ri_zhi: str = None
- req_shi_gan: str = None
- req_shi_zhi: str = None
- rsp_nian_gan: str
- rsp_nian_zhi: str
- rsp_yue_gan: str
- rsp_yue_zhi: str
- rsp_ri_gan: str
- rsp_ri_zhi: str
- rsp_shi_gan: str
- rsp_shi_zhi: str
- owner_id: int
- class LoadUserRequest(WXBean):
- owner_id: int
- class DeleteUserRequest(WXBean):
- owner_id: int
- user_id: int
|