InsMktCampaignDTO.py 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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.InsMktCouponConfigDTO import InsMktCouponConfigDTO
  6. from alipay.aop.api.domain.InsMktObjectDTO import InsMktObjectDTO
  7. class InsMktCampaignDTO(object):
  8. def __init__(self):
  9. self._campaign_id = None
  10. self._circulation = None
  11. self._coupon_config = None
  12. self._end_time = None
  13. self._memo = None
  14. self._mkt_objects = None
  15. self._name = None
  16. self._send_algorithm = None
  17. self._send_frqnc_type = None
  18. self._send_frqnc_value = None
  19. self._start_time = None
  20. self._status = None
  21. @property
  22. def campaign_id(self):
  23. return self._campaign_id
  24. @campaign_id.setter
  25. def campaign_id(self, value):
  26. self._campaign_id = value
  27. @property
  28. def circulation(self):
  29. return self._circulation
  30. @circulation.setter
  31. def circulation(self, value):
  32. self._circulation = value
  33. @property
  34. def coupon_config(self):
  35. return self._coupon_config
  36. @coupon_config.setter
  37. def coupon_config(self, value):
  38. if isinstance(value, InsMktCouponConfigDTO):
  39. self._coupon_config = value
  40. else:
  41. self._coupon_config = InsMktCouponConfigDTO.from_alipay_dict(value)
  42. @property
  43. def end_time(self):
  44. return self._end_time
  45. @end_time.setter
  46. def end_time(self, value):
  47. self._end_time = value
  48. @property
  49. def memo(self):
  50. return self._memo
  51. @memo.setter
  52. def memo(self, value):
  53. self._memo = value
  54. @property
  55. def mkt_objects(self):
  56. return self._mkt_objects
  57. @mkt_objects.setter
  58. def mkt_objects(self, value):
  59. if isinstance(value, list):
  60. self._mkt_objects = list()
  61. for i in value:
  62. if isinstance(i, InsMktObjectDTO):
  63. self._mkt_objects.append(i)
  64. else:
  65. self._mkt_objects.append(InsMktObjectDTO.from_alipay_dict(i))
  66. @property
  67. def name(self):
  68. return self._name
  69. @name.setter
  70. def name(self, value):
  71. self._name = value
  72. @property
  73. def send_algorithm(self):
  74. return self._send_algorithm
  75. @send_algorithm.setter
  76. def send_algorithm(self, value):
  77. self._send_algorithm = value
  78. @property
  79. def send_frqnc_type(self):
  80. return self._send_frqnc_type
  81. @send_frqnc_type.setter
  82. def send_frqnc_type(self, value):
  83. self._send_frqnc_type = value
  84. @property
  85. def send_frqnc_value(self):
  86. return self._send_frqnc_value
  87. @send_frqnc_value.setter
  88. def send_frqnc_value(self, value):
  89. self._send_frqnc_value = value
  90. @property
  91. def start_time(self):
  92. return self._start_time
  93. @start_time.setter
  94. def start_time(self, value):
  95. self._start_time = value
  96. @property
  97. def status(self):
  98. return self._status
  99. @status.setter
  100. def status(self, value):
  101. self._status = value
  102. def to_alipay_dict(self):
  103. params = dict()
  104. if self.campaign_id:
  105. if hasattr(self.campaign_id, 'to_alipay_dict'):
  106. params['campaign_id'] = self.campaign_id.to_alipay_dict()
  107. else:
  108. params['campaign_id'] = self.campaign_id
  109. if self.circulation:
  110. if hasattr(self.circulation, 'to_alipay_dict'):
  111. params['circulation'] = self.circulation.to_alipay_dict()
  112. else:
  113. params['circulation'] = self.circulation
  114. if self.coupon_config:
  115. if hasattr(self.coupon_config, 'to_alipay_dict'):
  116. params['coupon_config'] = self.coupon_config.to_alipay_dict()
  117. else:
  118. params['coupon_config'] = self.coupon_config
  119. if self.end_time:
  120. if hasattr(self.end_time, 'to_alipay_dict'):
  121. params['end_time'] = self.end_time.to_alipay_dict()
  122. else:
  123. params['end_time'] = self.end_time
  124. if self.memo:
  125. if hasattr(self.memo, 'to_alipay_dict'):
  126. params['memo'] = self.memo.to_alipay_dict()
  127. else:
  128. params['memo'] = self.memo
  129. if self.mkt_objects:
  130. if isinstance(self.mkt_objects, list):
  131. for i in range(0, len(self.mkt_objects)):
  132. element = self.mkt_objects[i]
  133. if hasattr(element, 'to_alipay_dict'):
  134. self.mkt_objects[i] = element.to_alipay_dict()
  135. if hasattr(self.mkt_objects, 'to_alipay_dict'):
  136. params['mkt_objects'] = self.mkt_objects.to_alipay_dict()
  137. else:
  138. params['mkt_objects'] = self.mkt_objects
  139. if self.name:
  140. if hasattr(self.name, 'to_alipay_dict'):
  141. params['name'] = self.name.to_alipay_dict()
  142. else:
  143. params['name'] = self.name
  144. if self.send_algorithm:
  145. if hasattr(self.send_algorithm, 'to_alipay_dict'):
  146. params['send_algorithm'] = self.send_algorithm.to_alipay_dict()
  147. else:
  148. params['send_algorithm'] = self.send_algorithm
  149. if self.send_frqnc_type:
  150. if hasattr(self.send_frqnc_type, 'to_alipay_dict'):
  151. params['send_frqnc_type'] = self.send_frqnc_type.to_alipay_dict()
  152. else:
  153. params['send_frqnc_type'] = self.send_frqnc_type
  154. if self.send_frqnc_value:
  155. if hasattr(self.send_frqnc_value, 'to_alipay_dict'):
  156. params['send_frqnc_value'] = self.send_frqnc_value.to_alipay_dict()
  157. else:
  158. params['send_frqnc_value'] = self.send_frqnc_value
  159. if self.start_time:
  160. if hasattr(self.start_time, 'to_alipay_dict'):
  161. params['start_time'] = self.start_time.to_alipay_dict()
  162. else:
  163. params['start_time'] = self.start_time
  164. if self.status:
  165. if hasattr(self.status, 'to_alipay_dict'):
  166. params['status'] = self.status.to_alipay_dict()
  167. else:
  168. params['status'] = self.status
  169. return params
  170. @staticmethod
  171. def from_alipay_dict(d):
  172. if not d:
  173. return None
  174. o = InsMktCampaignDTO()
  175. if 'campaign_id' in d:
  176. o.campaign_id = d['campaign_id']
  177. if 'circulation' in d:
  178. o.circulation = d['circulation']
  179. if 'coupon_config' in d:
  180. o.coupon_config = d['coupon_config']
  181. if 'end_time' in d:
  182. o.end_time = d['end_time']
  183. if 'memo' in d:
  184. o.memo = d['memo']
  185. if 'mkt_objects' in d:
  186. o.mkt_objects = d['mkt_objects']
  187. if 'name' in d:
  188. o.name = d['name']
  189. if 'send_algorithm' in d:
  190. o.send_algorithm = d['send_algorithm']
  191. if 'send_frqnc_type' in d:
  192. o.send_frqnc_type = d['send_frqnc_type']
  193. if 'send_frqnc_value' in d:
  194. o.send_frqnc_value = d['send_frqnc_value']
  195. if 'start_time' in d:
  196. o.start_time = d['start_time']
  197. if 'status' in d:
  198. o.status = d['status']
  199. return o