ContentInfoModel.py 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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.ContentExtInfoModel import ContentExtInfoModel
  6. class ContentInfoModel(object):
  7. def __init__(self):
  8. self._booth = None
  9. self._content_id_str = None
  10. self._ext_info = None
  11. self._link_url = None
  12. self._logo = None
  13. self._receive_status = None
  14. self._scene = None
  15. self._sub_title = None
  16. self._title = None
  17. self._touch_point = None
  18. @property
  19. def booth(self):
  20. return self._booth
  21. @booth.setter
  22. def booth(self, value):
  23. self._booth = value
  24. @property
  25. def content_id_str(self):
  26. return self._content_id_str
  27. @content_id_str.setter
  28. def content_id_str(self, value):
  29. self._content_id_str = value
  30. @property
  31. def ext_info(self):
  32. return self._ext_info
  33. @ext_info.setter
  34. def ext_info(self, value):
  35. if isinstance(value, ContentExtInfoModel):
  36. self._ext_info = value
  37. else:
  38. self._ext_info = ContentExtInfoModel.from_alipay_dict(value)
  39. @property
  40. def link_url(self):
  41. return self._link_url
  42. @link_url.setter
  43. def link_url(self, value):
  44. self._link_url = value
  45. @property
  46. def logo(self):
  47. return self._logo
  48. @logo.setter
  49. def logo(self, value):
  50. self._logo = value
  51. @property
  52. def receive_status(self):
  53. return self._receive_status
  54. @receive_status.setter
  55. def receive_status(self, value):
  56. self._receive_status = value
  57. @property
  58. def scene(self):
  59. return self._scene
  60. @scene.setter
  61. def scene(self, value):
  62. self._scene = value
  63. @property
  64. def sub_title(self):
  65. return self._sub_title
  66. @sub_title.setter
  67. def sub_title(self, value):
  68. self._sub_title = value
  69. @property
  70. def title(self):
  71. return self._title
  72. @title.setter
  73. def title(self, value):
  74. self._title = value
  75. @property
  76. def touch_point(self):
  77. return self._touch_point
  78. @touch_point.setter
  79. def touch_point(self, value):
  80. self._touch_point = value
  81. def to_alipay_dict(self):
  82. params = dict()
  83. if self.booth:
  84. if hasattr(self.booth, 'to_alipay_dict'):
  85. params['booth'] = self.booth.to_alipay_dict()
  86. else:
  87. params['booth'] = self.booth
  88. if self.content_id_str:
  89. if hasattr(self.content_id_str, 'to_alipay_dict'):
  90. params['content_id_str'] = self.content_id_str.to_alipay_dict()
  91. else:
  92. params['content_id_str'] = self.content_id_str
  93. if self.ext_info:
  94. if hasattr(self.ext_info, 'to_alipay_dict'):
  95. params['ext_info'] = self.ext_info.to_alipay_dict()
  96. else:
  97. params['ext_info'] = self.ext_info
  98. if self.link_url:
  99. if hasattr(self.link_url, 'to_alipay_dict'):
  100. params['link_url'] = self.link_url.to_alipay_dict()
  101. else:
  102. params['link_url'] = self.link_url
  103. if self.logo:
  104. if hasattr(self.logo, 'to_alipay_dict'):
  105. params['logo'] = self.logo.to_alipay_dict()
  106. else:
  107. params['logo'] = self.logo
  108. if self.receive_status:
  109. if hasattr(self.receive_status, 'to_alipay_dict'):
  110. params['receive_status'] = self.receive_status.to_alipay_dict()
  111. else:
  112. params['receive_status'] = self.receive_status
  113. if self.scene:
  114. if hasattr(self.scene, 'to_alipay_dict'):
  115. params['scene'] = self.scene.to_alipay_dict()
  116. else:
  117. params['scene'] = self.scene
  118. if self.sub_title:
  119. if hasattr(self.sub_title, 'to_alipay_dict'):
  120. params['sub_title'] = self.sub_title.to_alipay_dict()
  121. else:
  122. params['sub_title'] = self.sub_title
  123. if self.title:
  124. if hasattr(self.title, 'to_alipay_dict'):
  125. params['title'] = self.title.to_alipay_dict()
  126. else:
  127. params['title'] = self.title
  128. if self.touch_point:
  129. if hasattr(self.touch_point, 'to_alipay_dict'):
  130. params['touch_point'] = self.touch_point.to_alipay_dict()
  131. else:
  132. params['touch_point'] = self.touch_point
  133. return params
  134. @staticmethod
  135. def from_alipay_dict(d):
  136. if not d:
  137. return None
  138. o = ContentInfoModel()
  139. if 'booth' in d:
  140. o.booth = d['booth']
  141. if 'content_id_str' in d:
  142. o.content_id_str = d['content_id_str']
  143. if 'ext_info' in d:
  144. o.ext_info = d['ext_info']
  145. if 'link_url' in d:
  146. o.link_url = d['link_url']
  147. if 'logo' in d:
  148. o.logo = d['logo']
  149. if 'receive_status' in d:
  150. o.receive_status = d['receive_status']
  151. if 'scene' in d:
  152. o.scene = d['scene']
  153. if 'sub_title' in d:
  154. o.sub_title = d['sub_title']
  155. if 'title' in d:
  156. o.title = d['title']
  157. if 'touch_point' in d:
  158. o.touch_point = d['touch_point']
  159. return o