IntelligentPromoEffect.py 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class IntelligentPromoEffect(object):
  6. def __init__(self):
  7. self._avg_prize_increase = None
  8. self._cost = None
  9. self._current_total_amount = None
  10. self._effect_id = None
  11. self._gmt_from = None
  12. self._gmt_to = None
  13. self._gmv = None
  14. self._remain_stock_num = None
  15. self._repay_rate_increase = None
  16. self._send_count_increase = None
  17. self._take_count = None
  18. self._type = None
  19. self._use_count = None
  20. @property
  21. def avg_prize_increase(self):
  22. return self._avg_prize_increase
  23. @avg_prize_increase.setter
  24. def avg_prize_increase(self, value):
  25. self._avg_prize_increase = value
  26. @property
  27. def cost(self):
  28. return self._cost
  29. @cost.setter
  30. def cost(self, value):
  31. self._cost = value
  32. @property
  33. def current_total_amount(self):
  34. return self._current_total_amount
  35. @current_total_amount.setter
  36. def current_total_amount(self, value):
  37. self._current_total_amount = value
  38. @property
  39. def effect_id(self):
  40. return self._effect_id
  41. @effect_id.setter
  42. def effect_id(self, value):
  43. self._effect_id = value
  44. @property
  45. def gmt_from(self):
  46. return self._gmt_from
  47. @gmt_from.setter
  48. def gmt_from(self, value):
  49. self._gmt_from = value
  50. @property
  51. def gmt_to(self):
  52. return self._gmt_to
  53. @gmt_to.setter
  54. def gmt_to(self, value):
  55. self._gmt_to = value
  56. @property
  57. def gmv(self):
  58. return self._gmv
  59. @gmv.setter
  60. def gmv(self, value):
  61. self._gmv = value
  62. @property
  63. def remain_stock_num(self):
  64. return self._remain_stock_num
  65. @remain_stock_num.setter
  66. def remain_stock_num(self, value):
  67. self._remain_stock_num = value
  68. @property
  69. def repay_rate_increase(self):
  70. return self._repay_rate_increase
  71. @repay_rate_increase.setter
  72. def repay_rate_increase(self, value):
  73. self._repay_rate_increase = value
  74. @property
  75. def send_count_increase(self):
  76. return self._send_count_increase
  77. @send_count_increase.setter
  78. def send_count_increase(self, value):
  79. self._send_count_increase = value
  80. @property
  81. def take_count(self):
  82. return self._take_count
  83. @take_count.setter
  84. def take_count(self, value):
  85. self._take_count = value
  86. @property
  87. def type(self):
  88. return self._type
  89. @type.setter
  90. def type(self, value):
  91. self._type = value
  92. @property
  93. def use_count(self):
  94. return self._use_count
  95. @use_count.setter
  96. def use_count(self, value):
  97. self._use_count = value
  98. def to_alipay_dict(self):
  99. params = dict()
  100. if self.avg_prize_increase:
  101. if hasattr(self.avg_prize_increase, 'to_alipay_dict'):
  102. params['avg_prize_increase'] = self.avg_prize_increase.to_alipay_dict()
  103. else:
  104. params['avg_prize_increase'] = self.avg_prize_increase
  105. if self.cost:
  106. if hasattr(self.cost, 'to_alipay_dict'):
  107. params['cost'] = self.cost.to_alipay_dict()
  108. else:
  109. params['cost'] = self.cost
  110. if self.current_total_amount:
  111. if hasattr(self.current_total_amount, 'to_alipay_dict'):
  112. params['current_total_amount'] = self.current_total_amount.to_alipay_dict()
  113. else:
  114. params['current_total_amount'] = self.current_total_amount
  115. if self.effect_id:
  116. if hasattr(self.effect_id, 'to_alipay_dict'):
  117. params['effect_id'] = self.effect_id.to_alipay_dict()
  118. else:
  119. params['effect_id'] = self.effect_id
  120. if self.gmt_from:
  121. if hasattr(self.gmt_from, 'to_alipay_dict'):
  122. params['gmt_from'] = self.gmt_from.to_alipay_dict()
  123. else:
  124. params['gmt_from'] = self.gmt_from
  125. if self.gmt_to:
  126. if hasattr(self.gmt_to, 'to_alipay_dict'):
  127. params['gmt_to'] = self.gmt_to.to_alipay_dict()
  128. else:
  129. params['gmt_to'] = self.gmt_to
  130. if self.gmv:
  131. if hasattr(self.gmv, 'to_alipay_dict'):
  132. params['gmv'] = self.gmv.to_alipay_dict()
  133. else:
  134. params['gmv'] = self.gmv
  135. if self.remain_stock_num:
  136. if hasattr(self.remain_stock_num, 'to_alipay_dict'):
  137. params['remain_stock_num'] = self.remain_stock_num.to_alipay_dict()
  138. else:
  139. params['remain_stock_num'] = self.remain_stock_num
  140. if self.repay_rate_increase:
  141. if hasattr(self.repay_rate_increase, 'to_alipay_dict'):
  142. params['repay_rate_increase'] = self.repay_rate_increase.to_alipay_dict()
  143. else:
  144. params['repay_rate_increase'] = self.repay_rate_increase
  145. if self.send_count_increase:
  146. if hasattr(self.send_count_increase, 'to_alipay_dict'):
  147. params['send_count_increase'] = self.send_count_increase.to_alipay_dict()
  148. else:
  149. params['send_count_increase'] = self.send_count_increase
  150. if self.take_count:
  151. if hasattr(self.take_count, 'to_alipay_dict'):
  152. params['take_count'] = self.take_count.to_alipay_dict()
  153. else:
  154. params['take_count'] = self.take_count
  155. if self.type:
  156. if hasattr(self.type, 'to_alipay_dict'):
  157. params['type'] = self.type.to_alipay_dict()
  158. else:
  159. params['type'] = self.type
  160. if self.use_count:
  161. if hasattr(self.use_count, 'to_alipay_dict'):
  162. params['use_count'] = self.use_count.to_alipay_dict()
  163. else:
  164. params['use_count'] = self.use_count
  165. return params
  166. @staticmethod
  167. def from_alipay_dict(d):
  168. if not d:
  169. return None
  170. o = IntelligentPromoEffect()
  171. if 'avg_prize_increase' in d:
  172. o.avg_prize_increase = d['avg_prize_increase']
  173. if 'cost' in d:
  174. o.cost = d['cost']
  175. if 'current_total_amount' in d:
  176. o.current_total_amount = d['current_total_amount']
  177. if 'effect_id' in d:
  178. o.effect_id = d['effect_id']
  179. if 'gmt_from' in d:
  180. o.gmt_from = d['gmt_from']
  181. if 'gmt_to' in d:
  182. o.gmt_to = d['gmt_to']
  183. if 'gmv' in d:
  184. o.gmv = d['gmv']
  185. if 'remain_stock_num' in d:
  186. o.remain_stock_num = d['remain_stock_num']
  187. if 'repay_rate_increase' in d:
  188. o.repay_rate_increase = d['repay_rate_increase']
  189. if 'send_count_increase' in d:
  190. o.send_count_increase = d['send_count_increase']
  191. if 'take_count' in d:
  192. o.take_count = d['take_count']
  193. if 'type' in d:
  194. o.type = d['type']
  195. if 'use_count' in d:
  196. o.use_count = d['use_count']
  197. return o