InteligentGeneralMerchantPromo.py 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  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.CrowdConstraintInfo import CrowdConstraintInfo
  6. from alipay.aop.api.domain.IntelligentPromoEffect import IntelligentPromoEffect
  7. from alipay.aop.api.domain.InteligentBudgetInfo import InteligentBudgetInfo
  8. from alipay.aop.api.domain.InteligentConstraintInfo import InteligentConstraintInfo
  9. from alipay.aop.api.domain.InteligentPromoTool import InteligentPromoTool
  10. from alipay.aop.api.domain.InteligentPublishChannel import InteligentPublishChannel
  11. class InteligentGeneralMerchantPromo(object):
  12. def __init__(self):
  13. self._camp_id = None
  14. self._crowd_constraint = None
  15. self._desc = None
  16. self._ext_info = None
  17. self._forecast_effect = None
  18. self._inteligent_budget = None
  19. self._inteligent_constraint = None
  20. self._inteligent_promo_tools = None
  21. self._inteligent_publish_channels = None
  22. self._merchant_promo_type = None
  23. self._name = None
  24. self._template_id = None
  25. @property
  26. def camp_id(self):
  27. return self._camp_id
  28. @camp_id.setter
  29. def camp_id(self, value):
  30. self._camp_id = value
  31. @property
  32. def crowd_constraint(self):
  33. return self._crowd_constraint
  34. @crowd_constraint.setter
  35. def crowd_constraint(self, value):
  36. if isinstance(value, CrowdConstraintInfo):
  37. self._crowd_constraint = value
  38. else:
  39. self._crowd_constraint = CrowdConstraintInfo.from_alipay_dict(value)
  40. @property
  41. def desc(self):
  42. return self._desc
  43. @desc.setter
  44. def desc(self, value):
  45. self._desc = value
  46. @property
  47. def ext_info(self):
  48. return self._ext_info
  49. @ext_info.setter
  50. def ext_info(self, value):
  51. self._ext_info = value
  52. @property
  53. def forecast_effect(self):
  54. return self._forecast_effect
  55. @forecast_effect.setter
  56. def forecast_effect(self, value):
  57. if isinstance(value, IntelligentPromoEffect):
  58. self._forecast_effect = value
  59. else:
  60. self._forecast_effect = IntelligentPromoEffect.from_alipay_dict(value)
  61. @property
  62. def inteligent_budget(self):
  63. return self._inteligent_budget
  64. @inteligent_budget.setter
  65. def inteligent_budget(self, value):
  66. if isinstance(value, InteligentBudgetInfo):
  67. self._inteligent_budget = value
  68. else:
  69. self._inteligent_budget = InteligentBudgetInfo.from_alipay_dict(value)
  70. @property
  71. def inteligent_constraint(self):
  72. return self._inteligent_constraint
  73. @inteligent_constraint.setter
  74. def inteligent_constraint(self, value):
  75. if isinstance(value, InteligentConstraintInfo):
  76. self._inteligent_constraint = value
  77. else:
  78. self._inteligent_constraint = InteligentConstraintInfo.from_alipay_dict(value)
  79. @property
  80. def inteligent_promo_tools(self):
  81. return self._inteligent_promo_tools
  82. @inteligent_promo_tools.setter
  83. def inteligent_promo_tools(self, value):
  84. if isinstance(value, list):
  85. self._inteligent_promo_tools = list()
  86. for i in value:
  87. if isinstance(i, InteligentPromoTool):
  88. self._inteligent_promo_tools.append(i)
  89. else:
  90. self._inteligent_promo_tools.append(InteligentPromoTool.from_alipay_dict(i))
  91. @property
  92. def inteligent_publish_channels(self):
  93. return self._inteligent_publish_channels
  94. @inteligent_publish_channels.setter
  95. def inteligent_publish_channels(self, value):
  96. if isinstance(value, list):
  97. self._inteligent_publish_channels = list()
  98. for i in value:
  99. if isinstance(i, InteligentPublishChannel):
  100. self._inteligent_publish_channels.append(i)
  101. else:
  102. self._inteligent_publish_channels.append(InteligentPublishChannel.from_alipay_dict(i))
  103. @property
  104. def merchant_promo_type(self):
  105. return self._merchant_promo_type
  106. @merchant_promo_type.setter
  107. def merchant_promo_type(self, value):
  108. self._merchant_promo_type = value
  109. @property
  110. def name(self):
  111. return self._name
  112. @name.setter
  113. def name(self, value):
  114. self._name = value
  115. @property
  116. def template_id(self):
  117. return self._template_id
  118. @template_id.setter
  119. def template_id(self, value):
  120. self._template_id = value
  121. def to_alipay_dict(self):
  122. params = dict()
  123. if self.camp_id:
  124. if hasattr(self.camp_id, 'to_alipay_dict'):
  125. params['camp_id'] = self.camp_id.to_alipay_dict()
  126. else:
  127. params['camp_id'] = self.camp_id
  128. if self.crowd_constraint:
  129. if hasattr(self.crowd_constraint, 'to_alipay_dict'):
  130. params['crowd_constraint'] = self.crowd_constraint.to_alipay_dict()
  131. else:
  132. params['crowd_constraint'] = self.crowd_constraint
  133. if self.desc:
  134. if hasattr(self.desc, 'to_alipay_dict'):
  135. params['desc'] = self.desc.to_alipay_dict()
  136. else:
  137. params['desc'] = self.desc
  138. if self.ext_info:
  139. if hasattr(self.ext_info, 'to_alipay_dict'):
  140. params['ext_info'] = self.ext_info.to_alipay_dict()
  141. else:
  142. params['ext_info'] = self.ext_info
  143. if self.forecast_effect:
  144. if hasattr(self.forecast_effect, 'to_alipay_dict'):
  145. params['forecast_effect'] = self.forecast_effect.to_alipay_dict()
  146. else:
  147. params['forecast_effect'] = self.forecast_effect
  148. if self.inteligent_budget:
  149. if hasattr(self.inteligent_budget, 'to_alipay_dict'):
  150. params['inteligent_budget'] = self.inteligent_budget.to_alipay_dict()
  151. else:
  152. params['inteligent_budget'] = self.inteligent_budget
  153. if self.inteligent_constraint:
  154. if hasattr(self.inteligent_constraint, 'to_alipay_dict'):
  155. params['inteligent_constraint'] = self.inteligent_constraint.to_alipay_dict()
  156. else:
  157. params['inteligent_constraint'] = self.inteligent_constraint
  158. if self.inteligent_promo_tools:
  159. if isinstance(self.inteligent_promo_tools, list):
  160. for i in range(0, len(self.inteligent_promo_tools)):
  161. element = self.inteligent_promo_tools[i]
  162. if hasattr(element, 'to_alipay_dict'):
  163. self.inteligent_promo_tools[i] = element.to_alipay_dict()
  164. if hasattr(self.inteligent_promo_tools, 'to_alipay_dict'):
  165. params['inteligent_promo_tools'] = self.inteligent_promo_tools.to_alipay_dict()
  166. else:
  167. params['inteligent_promo_tools'] = self.inteligent_promo_tools
  168. if self.inteligent_publish_channels:
  169. if isinstance(self.inteligent_publish_channels, list):
  170. for i in range(0, len(self.inteligent_publish_channels)):
  171. element = self.inteligent_publish_channels[i]
  172. if hasattr(element, 'to_alipay_dict'):
  173. self.inteligent_publish_channels[i] = element.to_alipay_dict()
  174. if hasattr(self.inteligent_publish_channels, 'to_alipay_dict'):
  175. params['inteligent_publish_channels'] = self.inteligent_publish_channels.to_alipay_dict()
  176. else:
  177. params['inteligent_publish_channels'] = self.inteligent_publish_channels
  178. if self.merchant_promo_type:
  179. if hasattr(self.merchant_promo_type, 'to_alipay_dict'):
  180. params['merchant_promo_type'] = self.merchant_promo_type.to_alipay_dict()
  181. else:
  182. params['merchant_promo_type'] = self.merchant_promo_type
  183. if self.name:
  184. if hasattr(self.name, 'to_alipay_dict'):
  185. params['name'] = self.name.to_alipay_dict()
  186. else:
  187. params['name'] = self.name
  188. if self.template_id:
  189. if hasattr(self.template_id, 'to_alipay_dict'):
  190. params['template_id'] = self.template_id.to_alipay_dict()
  191. else:
  192. params['template_id'] = self.template_id
  193. return params
  194. @staticmethod
  195. def from_alipay_dict(d):
  196. if not d:
  197. return None
  198. o = InteligentGeneralMerchantPromo()
  199. if 'camp_id' in d:
  200. o.camp_id = d['camp_id']
  201. if 'crowd_constraint' in d:
  202. o.crowd_constraint = d['crowd_constraint']
  203. if 'desc' in d:
  204. o.desc = d['desc']
  205. if 'ext_info' in d:
  206. o.ext_info = d['ext_info']
  207. if 'forecast_effect' in d:
  208. o.forecast_effect = d['forecast_effect']
  209. if 'inteligent_budget' in d:
  210. o.inteligent_budget = d['inteligent_budget']
  211. if 'inteligent_constraint' in d:
  212. o.inteligent_constraint = d['inteligent_constraint']
  213. if 'inteligent_promo_tools' in d:
  214. o.inteligent_promo_tools = d['inteligent_promo_tools']
  215. if 'inteligent_publish_channels' in d:
  216. o.inteligent_publish_channels = d['inteligent_publish_channels']
  217. if 'merchant_promo_type' in d:
  218. o.merchant_promo_type = d['merchant_promo_type']
  219. if 'name' in d:
  220. o.name = d['name']
  221. if 'template_id' in d:
  222. o.template_id = d['template_id']
  223. return o