CdpDisplayContent.py 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class CdpDisplayContent(object):
  6. def __init__(self):
  7. self._action_url = None
  8. self._ext_info = None
  9. self._gmt_end = None
  10. self._gmt_start = None
  11. self._image_url = None
  12. self._text = None
  13. self._type = None
  14. @property
  15. def action_url(self):
  16. return self._action_url
  17. @action_url.setter
  18. def action_url(self, value):
  19. self._action_url = value
  20. @property
  21. def ext_info(self):
  22. return self._ext_info
  23. @ext_info.setter
  24. def ext_info(self, value):
  25. self._ext_info = value
  26. @property
  27. def gmt_end(self):
  28. return self._gmt_end
  29. @gmt_end.setter
  30. def gmt_end(self, value):
  31. self._gmt_end = value
  32. @property
  33. def gmt_start(self):
  34. return self._gmt_start
  35. @gmt_start.setter
  36. def gmt_start(self, value):
  37. self._gmt_start = value
  38. @property
  39. def image_url(self):
  40. return self._image_url
  41. @image_url.setter
  42. def image_url(self, value):
  43. self._image_url = value
  44. @property
  45. def text(self):
  46. return self._text
  47. @text.setter
  48. def text(self, value):
  49. self._text = value
  50. @property
  51. def type(self):
  52. return self._type
  53. @type.setter
  54. def type(self, value):
  55. self._type = value
  56. def to_alipay_dict(self):
  57. params = dict()
  58. if self.action_url:
  59. if hasattr(self.action_url, 'to_alipay_dict'):
  60. params['action_url'] = self.action_url.to_alipay_dict()
  61. else:
  62. params['action_url'] = self.action_url
  63. if self.ext_info:
  64. if hasattr(self.ext_info, 'to_alipay_dict'):
  65. params['ext_info'] = self.ext_info.to_alipay_dict()
  66. else:
  67. params['ext_info'] = self.ext_info
  68. if self.gmt_end:
  69. if hasattr(self.gmt_end, 'to_alipay_dict'):
  70. params['gmt_end'] = self.gmt_end.to_alipay_dict()
  71. else:
  72. params['gmt_end'] = self.gmt_end
  73. if self.gmt_start:
  74. if hasattr(self.gmt_start, 'to_alipay_dict'):
  75. params['gmt_start'] = self.gmt_start.to_alipay_dict()
  76. else:
  77. params['gmt_start'] = self.gmt_start
  78. if self.image_url:
  79. if hasattr(self.image_url, 'to_alipay_dict'):
  80. params['image_url'] = self.image_url.to_alipay_dict()
  81. else:
  82. params['image_url'] = self.image_url
  83. if self.text:
  84. if hasattr(self.text, 'to_alipay_dict'):
  85. params['text'] = self.text.to_alipay_dict()
  86. else:
  87. params['text'] = self.text
  88. if self.type:
  89. if hasattr(self.type, 'to_alipay_dict'):
  90. params['type'] = self.type.to_alipay_dict()
  91. else:
  92. params['type'] = self.type
  93. return params
  94. @staticmethod
  95. def from_alipay_dict(d):
  96. if not d:
  97. return None
  98. o = CdpDisplayContent()
  99. if 'action_url' in d:
  100. o.action_url = d['action_url']
  101. if 'ext_info' in d:
  102. o.ext_info = d['ext_info']
  103. if 'gmt_end' in d:
  104. o.gmt_end = d['gmt_end']
  105. if 'gmt_start' in d:
  106. o.gmt_start = d['gmt_start']
  107. if 'image_url' in d:
  108. o.image_url = d['image_url']
  109. if 'text' in d:
  110. o.text = d['text']
  111. if 'type' in d:
  112. o.type = d['type']
  113. return o