Hit.py 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class Hit(object):
  6. def __init__(self):
  7. self._action_param = None
  8. self._action_type = None
  9. self._biz_id = None
  10. self._desc = None
  11. self._ext_info = None
  12. self._icon = None
  13. self._name = None
  14. self._provider = None
  15. @property
  16. def action_param(self):
  17. return self._action_param
  18. @action_param.setter
  19. def action_param(self, value):
  20. self._action_param = value
  21. @property
  22. def action_type(self):
  23. return self._action_type
  24. @action_type.setter
  25. def action_type(self, value):
  26. self._action_type = value
  27. @property
  28. def biz_id(self):
  29. return self._biz_id
  30. @biz_id.setter
  31. def biz_id(self, value):
  32. self._biz_id = value
  33. @property
  34. def desc(self):
  35. return self._desc
  36. @desc.setter
  37. def desc(self, value):
  38. self._desc = value
  39. @property
  40. def ext_info(self):
  41. return self._ext_info
  42. @ext_info.setter
  43. def ext_info(self, value):
  44. self._ext_info = value
  45. @property
  46. def icon(self):
  47. return self._icon
  48. @icon.setter
  49. def icon(self, value):
  50. self._icon = value
  51. @property
  52. def name(self):
  53. return self._name
  54. @name.setter
  55. def name(self, value):
  56. self._name = value
  57. @property
  58. def provider(self):
  59. return self._provider
  60. @provider.setter
  61. def provider(self, value):
  62. self._provider = value
  63. def to_alipay_dict(self):
  64. params = dict()
  65. if self.action_param:
  66. if hasattr(self.action_param, 'to_alipay_dict'):
  67. params['action_param'] = self.action_param.to_alipay_dict()
  68. else:
  69. params['action_param'] = self.action_param
  70. if self.action_type:
  71. if hasattr(self.action_type, 'to_alipay_dict'):
  72. params['action_type'] = self.action_type.to_alipay_dict()
  73. else:
  74. params['action_type'] = self.action_type
  75. if self.biz_id:
  76. if hasattr(self.biz_id, 'to_alipay_dict'):
  77. params['biz_id'] = self.biz_id.to_alipay_dict()
  78. else:
  79. params['biz_id'] = self.biz_id
  80. if self.desc:
  81. if hasattr(self.desc, 'to_alipay_dict'):
  82. params['desc'] = self.desc.to_alipay_dict()
  83. else:
  84. params['desc'] = self.desc
  85. if self.ext_info:
  86. if hasattr(self.ext_info, 'to_alipay_dict'):
  87. params['ext_info'] = self.ext_info.to_alipay_dict()
  88. else:
  89. params['ext_info'] = self.ext_info
  90. if self.icon:
  91. if hasattr(self.icon, 'to_alipay_dict'):
  92. params['icon'] = self.icon.to_alipay_dict()
  93. else:
  94. params['icon'] = self.icon
  95. if self.name:
  96. if hasattr(self.name, 'to_alipay_dict'):
  97. params['name'] = self.name.to_alipay_dict()
  98. else:
  99. params['name'] = self.name
  100. if self.provider:
  101. if hasattr(self.provider, 'to_alipay_dict'):
  102. params['provider'] = self.provider.to_alipay_dict()
  103. else:
  104. params['provider'] = self.provider
  105. return params
  106. @staticmethod
  107. def from_alipay_dict(d):
  108. if not d:
  109. return None
  110. o = Hit()
  111. if 'action_param' in d:
  112. o.action_param = d['action_param']
  113. if 'action_type' in d:
  114. o.action_type = d['action_type']
  115. if 'biz_id' in d:
  116. o.biz_id = d['biz_id']
  117. if 'desc' in d:
  118. o.desc = d['desc']
  119. if 'ext_info' in d:
  120. o.ext_info = d['ext_info']
  121. if 'icon' in d:
  122. o.icon = d['icon']
  123. if 'name' in d:
  124. o.name = d['name']
  125. if 'provider' in d:
  126. o.provider = d['provider']
  127. return o