PromotionInfo.py 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class PromotionInfo(object):
  6. def __init__(self):
  7. self._brand_name = None
  8. self._collected = None
  9. self._collected_count = None
  10. self._detail_url = None
  11. self._icon_url = None
  12. self._main_image_url = None
  13. self._out_prize_id = None
  14. self._promotion_id = None
  15. self._title = None
  16. self._using_condition = None
  17. self._using_scope = None
  18. self._valid_date_from = None
  19. self._valid_date_to = None
  20. self._valid_time_text = None
  21. self._voucher_usage_status = None
  22. @property
  23. def brand_name(self):
  24. return self._brand_name
  25. @brand_name.setter
  26. def brand_name(self, value):
  27. self._brand_name = value
  28. @property
  29. def collected(self):
  30. return self._collected
  31. @collected.setter
  32. def collected(self, value):
  33. self._collected = value
  34. @property
  35. def collected_count(self):
  36. return self._collected_count
  37. @collected_count.setter
  38. def collected_count(self, value):
  39. self._collected_count = value
  40. @property
  41. def detail_url(self):
  42. return self._detail_url
  43. @detail_url.setter
  44. def detail_url(self, value):
  45. self._detail_url = value
  46. @property
  47. def icon_url(self):
  48. return self._icon_url
  49. @icon_url.setter
  50. def icon_url(self, value):
  51. self._icon_url = value
  52. @property
  53. def main_image_url(self):
  54. return self._main_image_url
  55. @main_image_url.setter
  56. def main_image_url(self, value):
  57. self._main_image_url = value
  58. @property
  59. def out_prize_id(self):
  60. return self._out_prize_id
  61. @out_prize_id.setter
  62. def out_prize_id(self, value):
  63. self._out_prize_id = value
  64. @property
  65. def promotion_id(self):
  66. return self._promotion_id
  67. @promotion_id.setter
  68. def promotion_id(self, value):
  69. self._promotion_id = value
  70. @property
  71. def title(self):
  72. return self._title
  73. @title.setter
  74. def title(self, value):
  75. self._title = value
  76. @property
  77. def using_condition(self):
  78. return self._using_condition
  79. @using_condition.setter
  80. def using_condition(self, value):
  81. self._using_condition = value
  82. @property
  83. def using_scope(self):
  84. return self._using_scope
  85. @using_scope.setter
  86. def using_scope(self, value):
  87. self._using_scope = value
  88. @property
  89. def valid_date_from(self):
  90. return self._valid_date_from
  91. @valid_date_from.setter
  92. def valid_date_from(self, value):
  93. self._valid_date_from = value
  94. @property
  95. def valid_date_to(self):
  96. return self._valid_date_to
  97. @valid_date_to.setter
  98. def valid_date_to(self, value):
  99. self._valid_date_to = value
  100. @property
  101. def valid_time_text(self):
  102. return self._valid_time_text
  103. @valid_time_text.setter
  104. def valid_time_text(self, value):
  105. self._valid_time_text = value
  106. @property
  107. def voucher_usage_status(self):
  108. return self._voucher_usage_status
  109. @voucher_usage_status.setter
  110. def voucher_usage_status(self, value):
  111. self._voucher_usage_status = value
  112. def to_alipay_dict(self):
  113. params = dict()
  114. if self.brand_name:
  115. if hasattr(self.brand_name, 'to_alipay_dict'):
  116. params['brand_name'] = self.brand_name.to_alipay_dict()
  117. else:
  118. params['brand_name'] = self.brand_name
  119. if self.collected:
  120. if hasattr(self.collected, 'to_alipay_dict'):
  121. params['collected'] = self.collected.to_alipay_dict()
  122. else:
  123. params['collected'] = self.collected
  124. if self.collected_count:
  125. if hasattr(self.collected_count, 'to_alipay_dict'):
  126. params['collected_count'] = self.collected_count.to_alipay_dict()
  127. else:
  128. params['collected_count'] = self.collected_count
  129. if self.detail_url:
  130. if hasattr(self.detail_url, 'to_alipay_dict'):
  131. params['detail_url'] = self.detail_url.to_alipay_dict()
  132. else:
  133. params['detail_url'] = self.detail_url
  134. if self.icon_url:
  135. if hasattr(self.icon_url, 'to_alipay_dict'):
  136. params['icon_url'] = self.icon_url.to_alipay_dict()
  137. else:
  138. params['icon_url'] = self.icon_url
  139. if self.main_image_url:
  140. if hasattr(self.main_image_url, 'to_alipay_dict'):
  141. params['main_image_url'] = self.main_image_url.to_alipay_dict()
  142. else:
  143. params['main_image_url'] = self.main_image_url
  144. if self.out_prize_id:
  145. if hasattr(self.out_prize_id, 'to_alipay_dict'):
  146. params['out_prize_id'] = self.out_prize_id.to_alipay_dict()
  147. else:
  148. params['out_prize_id'] = self.out_prize_id
  149. if self.promotion_id:
  150. if hasattr(self.promotion_id, 'to_alipay_dict'):
  151. params['promotion_id'] = self.promotion_id.to_alipay_dict()
  152. else:
  153. params['promotion_id'] = self.promotion_id
  154. if self.title:
  155. if hasattr(self.title, 'to_alipay_dict'):
  156. params['title'] = self.title.to_alipay_dict()
  157. else:
  158. params['title'] = self.title
  159. if self.using_condition:
  160. if hasattr(self.using_condition, 'to_alipay_dict'):
  161. params['using_condition'] = self.using_condition.to_alipay_dict()
  162. else:
  163. params['using_condition'] = self.using_condition
  164. if self.using_scope:
  165. if hasattr(self.using_scope, 'to_alipay_dict'):
  166. params['using_scope'] = self.using_scope.to_alipay_dict()
  167. else:
  168. params['using_scope'] = self.using_scope
  169. if self.valid_date_from:
  170. if hasattr(self.valid_date_from, 'to_alipay_dict'):
  171. params['valid_date_from'] = self.valid_date_from.to_alipay_dict()
  172. else:
  173. params['valid_date_from'] = self.valid_date_from
  174. if self.valid_date_to:
  175. if hasattr(self.valid_date_to, 'to_alipay_dict'):
  176. params['valid_date_to'] = self.valid_date_to.to_alipay_dict()
  177. else:
  178. params['valid_date_to'] = self.valid_date_to
  179. if self.valid_time_text:
  180. if hasattr(self.valid_time_text, 'to_alipay_dict'):
  181. params['valid_time_text'] = self.valid_time_text.to_alipay_dict()
  182. else:
  183. params['valid_time_text'] = self.valid_time_text
  184. if self.voucher_usage_status:
  185. if hasattr(self.voucher_usage_status, 'to_alipay_dict'):
  186. params['voucher_usage_status'] = self.voucher_usage_status.to_alipay_dict()
  187. else:
  188. params['voucher_usage_status'] = self.voucher_usage_status
  189. return params
  190. @staticmethod
  191. def from_alipay_dict(d):
  192. if not d:
  193. return None
  194. o = PromotionInfo()
  195. if 'brand_name' in d:
  196. o.brand_name = d['brand_name']
  197. if 'collected' in d:
  198. o.collected = d['collected']
  199. if 'collected_count' in d:
  200. o.collected_count = d['collected_count']
  201. if 'detail_url' in d:
  202. o.detail_url = d['detail_url']
  203. if 'icon_url' in d:
  204. o.icon_url = d['icon_url']
  205. if 'main_image_url' in d:
  206. o.main_image_url = d['main_image_url']
  207. if 'out_prize_id' in d:
  208. o.out_prize_id = d['out_prize_id']
  209. if 'promotion_id' in d:
  210. o.promotion_id = d['promotion_id']
  211. if 'title' in d:
  212. o.title = d['title']
  213. if 'using_condition' in d:
  214. o.using_condition = d['using_condition']
  215. if 'using_scope' in d:
  216. o.using_scope = d['using_scope']
  217. if 'valid_date_from' in d:
  218. o.valid_date_from = d['valid_date_from']
  219. if 'valid_date_to' in d:
  220. o.valid_date_to = d['valid_date_to']
  221. if 'valid_time_text' in d:
  222. o.valid_time_text = d['valid_time_text']
  223. if 'voucher_usage_status' in d:
  224. o.voucher_usage_status = d['voucher_usage_status']
  225. return o