AlipayMarketingCampaignDiscountOperateModel.py 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. from alipay.aop.api.domain.DiscountDstCampPrizeModel import DiscountDstCampPrizeModel
  6. from alipay.aop.api.domain.DstCampRuleModel import DstCampRuleModel
  7. from alipay.aop.api.domain.DateAreaModel import DateAreaModel
  8. from alipay.aop.api.domain.RandomDiscountDstCampPrizeModel import RandomDiscountDstCampPrizeModel
  9. from alipay.aop.api.domain.ReduceDstCampPrizeModel import ReduceDstCampPrizeModel
  10. from alipay.aop.api.domain.ReduceToDiscountDstCampPrizeModel import ReduceToDiscountDstCampPrizeModel
  11. from alipay.aop.api.domain.ResetZeroDstCampPrizeModel import ResetZeroDstCampPrizeModel
  12. from alipay.aop.api.domain.SingleDstCampPrizeModel import SingleDstCampPrizeModel
  13. from alipay.aop.api.domain.StagedDiscountDstCampPrizeModel import StagedDiscountDstCampPrizeModel
  14. class AlipayMarketingCampaignDiscountOperateModel(object):
  15. def __init__(self):
  16. self._camp_code = None
  17. self._camp_desc = None
  18. self._camp_id = None
  19. self._camp_name = None
  20. self._camp_slogan = None
  21. self._discount_dst_camp_prize_model = None
  22. self._dst_camp_rule_model = None
  23. self._dst_camp_sub_time_model_list = None
  24. self._gmt_end = None
  25. self._gmt_start = None
  26. self._operate_type = None
  27. self._prize_type = None
  28. self._random_discount_dst_camp_prize_model = None
  29. self._reduce_dst_camp_prize_model = None
  30. self._reduce_to_discount_dst_camp_prize_model = None
  31. self._reset_zero_dst_camp_prize_model = None
  32. self._single_dst_camp_prize_model = None
  33. self._staged_discount_dst_camp_prize_model = None
  34. @property
  35. def camp_code(self):
  36. return self._camp_code
  37. @camp_code.setter
  38. def camp_code(self, value):
  39. self._camp_code = value
  40. @property
  41. def camp_desc(self):
  42. return self._camp_desc
  43. @camp_desc.setter
  44. def camp_desc(self, value):
  45. self._camp_desc = value
  46. @property
  47. def camp_id(self):
  48. return self._camp_id
  49. @camp_id.setter
  50. def camp_id(self, value):
  51. self._camp_id = value
  52. @property
  53. def camp_name(self):
  54. return self._camp_name
  55. @camp_name.setter
  56. def camp_name(self, value):
  57. self._camp_name = value
  58. @property
  59. def camp_slogan(self):
  60. return self._camp_slogan
  61. @camp_slogan.setter
  62. def camp_slogan(self, value):
  63. self._camp_slogan = value
  64. @property
  65. def discount_dst_camp_prize_model(self):
  66. return self._discount_dst_camp_prize_model
  67. @discount_dst_camp_prize_model.setter
  68. def discount_dst_camp_prize_model(self, value):
  69. if isinstance(value, DiscountDstCampPrizeModel):
  70. self._discount_dst_camp_prize_model = value
  71. else:
  72. self._discount_dst_camp_prize_model = DiscountDstCampPrizeModel.from_alipay_dict(value)
  73. @property
  74. def dst_camp_rule_model(self):
  75. return self._dst_camp_rule_model
  76. @dst_camp_rule_model.setter
  77. def dst_camp_rule_model(self, value):
  78. if isinstance(value, DstCampRuleModel):
  79. self._dst_camp_rule_model = value
  80. else:
  81. self._dst_camp_rule_model = DstCampRuleModel.from_alipay_dict(value)
  82. @property
  83. def dst_camp_sub_time_model_list(self):
  84. return self._dst_camp_sub_time_model_list
  85. @dst_camp_sub_time_model_list.setter
  86. def dst_camp_sub_time_model_list(self, value):
  87. if isinstance(value, list):
  88. self._dst_camp_sub_time_model_list = list()
  89. for i in value:
  90. if isinstance(i, DateAreaModel):
  91. self._dst_camp_sub_time_model_list.append(i)
  92. else:
  93. self._dst_camp_sub_time_model_list.append(DateAreaModel.from_alipay_dict(i))
  94. @property
  95. def gmt_end(self):
  96. return self._gmt_end
  97. @gmt_end.setter
  98. def gmt_end(self, value):
  99. self._gmt_end = value
  100. @property
  101. def gmt_start(self):
  102. return self._gmt_start
  103. @gmt_start.setter
  104. def gmt_start(self, value):
  105. self._gmt_start = value
  106. @property
  107. def operate_type(self):
  108. return self._operate_type
  109. @operate_type.setter
  110. def operate_type(self, value):
  111. self._operate_type = value
  112. @property
  113. def prize_type(self):
  114. return self._prize_type
  115. @prize_type.setter
  116. def prize_type(self, value):
  117. self._prize_type = value
  118. @property
  119. def random_discount_dst_camp_prize_model(self):
  120. return self._random_discount_dst_camp_prize_model
  121. @random_discount_dst_camp_prize_model.setter
  122. def random_discount_dst_camp_prize_model(self, value):
  123. if isinstance(value, RandomDiscountDstCampPrizeModel):
  124. self._random_discount_dst_camp_prize_model = value
  125. else:
  126. self._random_discount_dst_camp_prize_model = RandomDiscountDstCampPrizeModel.from_alipay_dict(value)
  127. @property
  128. def reduce_dst_camp_prize_model(self):
  129. return self._reduce_dst_camp_prize_model
  130. @reduce_dst_camp_prize_model.setter
  131. def reduce_dst_camp_prize_model(self, value):
  132. if isinstance(value, ReduceDstCampPrizeModel):
  133. self._reduce_dst_camp_prize_model = value
  134. else:
  135. self._reduce_dst_camp_prize_model = ReduceDstCampPrizeModel.from_alipay_dict(value)
  136. @property
  137. def reduce_to_discount_dst_camp_prize_model(self):
  138. return self._reduce_to_discount_dst_camp_prize_model
  139. @reduce_to_discount_dst_camp_prize_model.setter
  140. def reduce_to_discount_dst_camp_prize_model(self, value):
  141. if isinstance(value, ReduceToDiscountDstCampPrizeModel):
  142. self._reduce_to_discount_dst_camp_prize_model = value
  143. else:
  144. self._reduce_to_discount_dst_camp_prize_model = ReduceToDiscountDstCampPrizeModel.from_alipay_dict(value)
  145. @property
  146. def reset_zero_dst_camp_prize_model(self):
  147. return self._reset_zero_dst_camp_prize_model
  148. @reset_zero_dst_camp_prize_model.setter
  149. def reset_zero_dst_camp_prize_model(self, value):
  150. if isinstance(value, ResetZeroDstCampPrizeModel):
  151. self._reset_zero_dst_camp_prize_model = value
  152. else:
  153. self._reset_zero_dst_camp_prize_model = ResetZeroDstCampPrizeModel.from_alipay_dict(value)
  154. @property
  155. def single_dst_camp_prize_model(self):
  156. return self._single_dst_camp_prize_model
  157. @single_dst_camp_prize_model.setter
  158. def single_dst_camp_prize_model(self, value):
  159. if isinstance(value, SingleDstCampPrizeModel):
  160. self._single_dst_camp_prize_model = value
  161. else:
  162. self._single_dst_camp_prize_model = SingleDstCampPrizeModel.from_alipay_dict(value)
  163. @property
  164. def staged_discount_dst_camp_prize_model(self):
  165. return self._staged_discount_dst_camp_prize_model
  166. @staged_discount_dst_camp_prize_model.setter
  167. def staged_discount_dst_camp_prize_model(self, value):
  168. if isinstance(value, StagedDiscountDstCampPrizeModel):
  169. self._staged_discount_dst_camp_prize_model = value
  170. else:
  171. self._staged_discount_dst_camp_prize_model = StagedDiscountDstCampPrizeModel.from_alipay_dict(value)
  172. def to_alipay_dict(self):
  173. params = dict()
  174. if self.camp_code:
  175. if hasattr(self.camp_code, 'to_alipay_dict'):
  176. params['camp_code'] = self.camp_code.to_alipay_dict()
  177. else:
  178. params['camp_code'] = self.camp_code
  179. if self.camp_desc:
  180. if hasattr(self.camp_desc, 'to_alipay_dict'):
  181. params['camp_desc'] = self.camp_desc.to_alipay_dict()
  182. else:
  183. params['camp_desc'] = self.camp_desc
  184. if self.camp_id:
  185. if hasattr(self.camp_id, 'to_alipay_dict'):
  186. params['camp_id'] = self.camp_id.to_alipay_dict()
  187. else:
  188. params['camp_id'] = self.camp_id
  189. if self.camp_name:
  190. if hasattr(self.camp_name, 'to_alipay_dict'):
  191. params['camp_name'] = self.camp_name.to_alipay_dict()
  192. else:
  193. params['camp_name'] = self.camp_name
  194. if self.camp_slogan:
  195. if hasattr(self.camp_slogan, 'to_alipay_dict'):
  196. params['camp_slogan'] = self.camp_slogan.to_alipay_dict()
  197. else:
  198. params['camp_slogan'] = self.camp_slogan
  199. if self.discount_dst_camp_prize_model:
  200. if hasattr(self.discount_dst_camp_prize_model, 'to_alipay_dict'):
  201. params['discount_dst_camp_prize_model'] = self.discount_dst_camp_prize_model.to_alipay_dict()
  202. else:
  203. params['discount_dst_camp_prize_model'] = self.discount_dst_camp_prize_model
  204. if self.dst_camp_rule_model:
  205. if hasattr(self.dst_camp_rule_model, 'to_alipay_dict'):
  206. params['dst_camp_rule_model'] = self.dst_camp_rule_model.to_alipay_dict()
  207. else:
  208. params['dst_camp_rule_model'] = self.dst_camp_rule_model
  209. if self.dst_camp_sub_time_model_list:
  210. if isinstance(self.dst_camp_sub_time_model_list, list):
  211. for i in range(0, len(self.dst_camp_sub_time_model_list)):
  212. element = self.dst_camp_sub_time_model_list[i]
  213. if hasattr(element, 'to_alipay_dict'):
  214. self.dst_camp_sub_time_model_list[i] = element.to_alipay_dict()
  215. if hasattr(self.dst_camp_sub_time_model_list, 'to_alipay_dict'):
  216. params['dst_camp_sub_time_model_list'] = self.dst_camp_sub_time_model_list.to_alipay_dict()
  217. else:
  218. params['dst_camp_sub_time_model_list'] = self.dst_camp_sub_time_model_list
  219. if self.gmt_end:
  220. if hasattr(self.gmt_end, 'to_alipay_dict'):
  221. params['gmt_end'] = self.gmt_end.to_alipay_dict()
  222. else:
  223. params['gmt_end'] = self.gmt_end
  224. if self.gmt_start:
  225. if hasattr(self.gmt_start, 'to_alipay_dict'):
  226. params['gmt_start'] = self.gmt_start.to_alipay_dict()
  227. else:
  228. params['gmt_start'] = self.gmt_start
  229. if self.operate_type:
  230. if hasattr(self.operate_type, 'to_alipay_dict'):
  231. params['operate_type'] = self.operate_type.to_alipay_dict()
  232. else:
  233. params['operate_type'] = self.operate_type
  234. if self.prize_type:
  235. if hasattr(self.prize_type, 'to_alipay_dict'):
  236. params['prize_type'] = self.prize_type.to_alipay_dict()
  237. else:
  238. params['prize_type'] = self.prize_type
  239. if self.random_discount_dst_camp_prize_model:
  240. if hasattr(self.random_discount_dst_camp_prize_model, 'to_alipay_dict'):
  241. params['random_discount_dst_camp_prize_model'] = self.random_discount_dst_camp_prize_model.to_alipay_dict()
  242. else:
  243. params['random_discount_dst_camp_prize_model'] = self.random_discount_dst_camp_prize_model
  244. if self.reduce_dst_camp_prize_model:
  245. if hasattr(self.reduce_dst_camp_prize_model, 'to_alipay_dict'):
  246. params['reduce_dst_camp_prize_model'] = self.reduce_dst_camp_prize_model.to_alipay_dict()
  247. else:
  248. params['reduce_dst_camp_prize_model'] = self.reduce_dst_camp_prize_model
  249. if self.reduce_to_discount_dst_camp_prize_model:
  250. if hasattr(self.reduce_to_discount_dst_camp_prize_model, 'to_alipay_dict'):
  251. params['reduce_to_discount_dst_camp_prize_model'] = self.reduce_to_discount_dst_camp_prize_model.to_alipay_dict()
  252. else:
  253. params['reduce_to_discount_dst_camp_prize_model'] = self.reduce_to_discount_dst_camp_prize_model
  254. if self.reset_zero_dst_camp_prize_model:
  255. if hasattr(self.reset_zero_dst_camp_prize_model, 'to_alipay_dict'):
  256. params['reset_zero_dst_camp_prize_model'] = self.reset_zero_dst_camp_prize_model.to_alipay_dict()
  257. else:
  258. params['reset_zero_dst_camp_prize_model'] = self.reset_zero_dst_camp_prize_model
  259. if self.single_dst_camp_prize_model:
  260. if hasattr(self.single_dst_camp_prize_model, 'to_alipay_dict'):
  261. params['single_dst_camp_prize_model'] = self.single_dst_camp_prize_model.to_alipay_dict()
  262. else:
  263. params['single_dst_camp_prize_model'] = self.single_dst_camp_prize_model
  264. if self.staged_discount_dst_camp_prize_model:
  265. if hasattr(self.staged_discount_dst_camp_prize_model, 'to_alipay_dict'):
  266. params['staged_discount_dst_camp_prize_model'] = self.staged_discount_dst_camp_prize_model.to_alipay_dict()
  267. else:
  268. params['staged_discount_dst_camp_prize_model'] = self.staged_discount_dst_camp_prize_model
  269. return params
  270. @staticmethod
  271. def from_alipay_dict(d):
  272. if not d:
  273. return None
  274. o = AlipayMarketingCampaignDiscountOperateModel()
  275. if 'camp_code' in d:
  276. o.camp_code = d['camp_code']
  277. if 'camp_desc' in d:
  278. o.camp_desc = d['camp_desc']
  279. if 'camp_id' in d:
  280. o.camp_id = d['camp_id']
  281. if 'camp_name' in d:
  282. o.camp_name = d['camp_name']
  283. if 'camp_slogan' in d:
  284. o.camp_slogan = d['camp_slogan']
  285. if 'discount_dst_camp_prize_model' in d:
  286. o.discount_dst_camp_prize_model = d['discount_dst_camp_prize_model']
  287. if 'dst_camp_rule_model' in d:
  288. o.dst_camp_rule_model = d['dst_camp_rule_model']
  289. if 'dst_camp_sub_time_model_list' in d:
  290. o.dst_camp_sub_time_model_list = d['dst_camp_sub_time_model_list']
  291. if 'gmt_end' in d:
  292. o.gmt_end = d['gmt_end']
  293. if 'gmt_start' in d:
  294. o.gmt_start = d['gmt_start']
  295. if 'operate_type' in d:
  296. o.operate_type = d['operate_type']
  297. if 'prize_type' in d:
  298. o.prize_type = d['prize_type']
  299. if 'random_discount_dst_camp_prize_model' in d:
  300. o.random_discount_dst_camp_prize_model = d['random_discount_dst_camp_prize_model']
  301. if 'reduce_dst_camp_prize_model' in d:
  302. o.reduce_dst_camp_prize_model = d['reduce_dst_camp_prize_model']
  303. if 'reduce_to_discount_dst_camp_prize_model' in d:
  304. o.reduce_to_discount_dst_camp_prize_model = d['reduce_to_discount_dst_camp_prize_model']
  305. if 'reset_zero_dst_camp_prize_model' in d:
  306. o.reset_zero_dst_camp_prize_model = d['reset_zero_dst_camp_prize_model']
  307. if 'single_dst_camp_prize_model' in d:
  308. o.single_dst_camp_prize_model = d['single_dst_camp_prize_model']
  309. if 'staged_discount_dst_camp_prize_model' in d:
  310. o.staged_discount_dst_camp_prize_model = d['staged_discount_dst_camp_prize_model']
  311. return o