wxModels.py 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. class WXBean(object):
  2. def __repr__(self):
  3. result = self.__class__.__name__ + "\n"
  4. for key in self.__dir__():
  5. if not key.startswith('__'):
  6. value = getattr(self, key)
  7. if not callable(value):
  8. result += " " + key + " = " + str(value) + "\n"
  9. return result
  10. @classmethod
  11. def build_from(cls, obj: {}):
  12. bean = cls()
  13. for key in obj:
  14. if len(key) > 0:
  15. value = obj[key]
  16. setattr(bean, key, value)
  17. return bean
  18. class WXUserMsg(WXBean):
  19. URL: str
  20. ToUserName: str
  21. FromUserName: str
  22. CreateTime: int
  23. MsgType: str
  24. Content: str
  25. MsgId: int
  26. class WXMenu(WXBean):
  27. obj: {}
  28. def __init__(self):
  29. self.obj = {
  30. "button": []
  31. }
  32. def add_click_button(self, text: str, key: str):
  33. temp = {
  34. "type": "click",
  35. "name": text,
  36. "key": key,
  37. }
  38. self.obj["button"].append(temp)
  39. def add_view_button(self, text: str, url: str):
  40. temp = {
  41. "type": "view",
  42. "name": text,
  43. "url": url,
  44. }
  45. self.obj["button"].append(temp)
  46. class UserRequest(WXBean):
  47. user_name: str
  48. is_man: bool
  49. date_mode: int
  50. born_year: int
  51. born_month: int
  52. born_day: int
  53. know_time: int
  54. born_hour: int
  55. born_minute: int
  56. born_sheng: str
  57. born_shi: str
  58. born_qu: str
  59. open_id: str
  60. class LoginRequest(WXBean):
  61. account: str
  62. password: str
  63. userAgent: str
  64. screenResolution: str
  65. colorDepth: str
  66. timezoneOffset: str
  67. language: str
  68. class GetSiZhuRequest(WXBean):
  69. uid: int
  70. token: str
  71. isMan: bool
  72. year: int
  73. month: int
  74. day: int
  75. hourMode: int
  76. hour: int
  77. minute: int
  78. areaMode: int
  79. sheng: str
  80. shi: str
  81. qu: str
  82. def __init__(self):
  83. self.hour = None
  84. self.minute = None
  85. self.sheng = "未知地区"
  86. self.shi = "-"
  87. self.qu = "-"
  88. def fix_data(self):
  89. if self.hour is None or self.minute is None:
  90. self.hour = None
  91. self.minute = None
  92. class CalcNongLiRequest(WXBean):
  93. year: int
  94. month: str
  95. day: str
  96. class GetSiZhuByNongLiRequest(WXBean):
  97. uid: int
  98. token: str
  99. isMan: bool
  100. year: int
  101. month: str
  102. day: str
  103. hourMode: int
  104. hour: int
  105. minute: int
  106. areaMode: int
  107. sheng: str
  108. shi: str
  109. qu: str
  110. def __init__(self):
  111. self.hour = None
  112. self.minute = None
  113. self.sheng = "未知地区"
  114. self.shi = "-"
  115. self.qu = "-"
  116. def fix_data(self):
  117. if self.hour is None or self.minute is None:
  118. self.hour = None
  119. self.minute = None
  120. class GetSiZhuByTextsRequest(WXBean):
  121. uid: int
  122. token: str
  123. isMan: bool
  124. niangan: str
  125. nianzhi: str
  126. yuegan: str
  127. yuezhi: str
  128. rigan: str
  129. rizhi: str
  130. shigan: str
  131. shizhi: str
  132. ignoreError: bool
  133. class SaveUserRequest(WXBean):
  134. name: str
  135. isMan: bool
  136. dateMode: int
  137. year: int = None
  138. month: str = None
  139. day: str = None
  140. hourMode: int = None
  141. hour: int = None
  142. minute: int = None
  143. areaMode: int = None
  144. sheng: str = None
  145. shi: str = None
  146. qu: str = None
  147. extra: str = None
  148. nongli_year: int = None
  149. nongli_month: str = None
  150. nongli_day: str = None
  151. req_nian_gan: str = None
  152. req_nian_zhi: str = None
  153. req_yue_gan: str = None
  154. req_yue_zhi: str = None
  155. req_ri_gan: str = None
  156. req_ri_zhi: str = None
  157. req_shi_gan: str = None
  158. req_shi_zhi: str = None
  159. rsp_nian_gan: str
  160. rsp_nian_zhi: str
  161. rsp_yue_gan: str
  162. rsp_yue_zhi: str
  163. rsp_ri_gan: str
  164. rsp_ri_zhi: str
  165. rsp_shi_gan: str
  166. rsp_shi_zhi: str
  167. owner_id: int
  168. class LoadUserRequest(WXBean):
  169. owner_id: int
  170. class DeleteUserRequest(WXBean):
  171. owner_id: int
  172. user_id: int