KbdishMaterialInfo.py 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class KbdishMaterialInfo(object):
  6. def __init__(self):
  7. self._add_price = None
  8. self._create_user = None
  9. self._ext_info = None
  10. self._material_id = None
  11. self._material_img = None
  12. self._material_name = None
  13. self._material_type = None
  14. self._max_num = None
  15. self._merchant_id = None
  16. self._public_id = None
  17. self._update_user = None
  18. @property
  19. def add_price(self):
  20. return self._add_price
  21. @add_price.setter
  22. def add_price(self, value):
  23. self._add_price = value
  24. @property
  25. def create_user(self):
  26. return self._create_user
  27. @create_user.setter
  28. def create_user(self, value):
  29. self._create_user = value
  30. @property
  31. def ext_info(self):
  32. return self._ext_info
  33. @ext_info.setter
  34. def ext_info(self, value):
  35. self._ext_info = value
  36. @property
  37. def material_id(self):
  38. return self._material_id
  39. @material_id.setter
  40. def material_id(self, value):
  41. self._material_id = value
  42. @property
  43. def material_img(self):
  44. return self._material_img
  45. @material_img.setter
  46. def material_img(self, value):
  47. self._material_img = value
  48. @property
  49. def material_name(self):
  50. return self._material_name
  51. @material_name.setter
  52. def material_name(self, value):
  53. self._material_name = value
  54. @property
  55. def material_type(self):
  56. return self._material_type
  57. @material_type.setter
  58. def material_type(self, value):
  59. self._material_type = value
  60. @property
  61. def max_num(self):
  62. return self._max_num
  63. @max_num.setter
  64. def max_num(self, value):
  65. self._max_num = value
  66. @property
  67. def merchant_id(self):
  68. return self._merchant_id
  69. @merchant_id.setter
  70. def merchant_id(self, value):
  71. self._merchant_id = value
  72. @property
  73. def public_id(self):
  74. return self._public_id
  75. @public_id.setter
  76. def public_id(self, value):
  77. self._public_id = value
  78. @property
  79. def update_user(self):
  80. return self._update_user
  81. @update_user.setter
  82. def update_user(self, value):
  83. self._update_user = value
  84. def to_alipay_dict(self):
  85. params = dict()
  86. if self.add_price:
  87. if hasattr(self.add_price, 'to_alipay_dict'):
  88. params['add_price'] = self.add_price.to_alipay_dict()
  89. else:
  90. params['add_price'] = self.add_price
  91. if self.create_user:
  92. if hasattr(self.create_user, 'to_alipay_dict'):
  93. params['create_user'] = self.create_user.to_alipay_dict()
  94. else:
  95. params['create_user'] = self.create_user
  96. if self.ext_info:
  97. if hasattr(self.ext_info, 'to_alipay_dict'):
  98. params['ext_info'] = self.ext_info.to_alipay_dict()
  99. else:
  100. params['ext_info'] = self.ext_info
  101. if self.material_id:
  102. if hasattr(self.material_id, 'to_alipay_dict'):
  103. params['material_id'] = self.material_id.to_alipay_dict()
  104. else:
  105. params['material_id'] = self.material_id
  106. if self.material_img:
  107. if hasattr(self.material_img, 'to_alipay_dict'):
  108. params['material_img'] = self.material_img.to_alipay_dict()
  109. else:
  110. params['material_img'] = self.material_img
  111. if self.material_name:
  112. if hasattr(self.material_name, 'to_alipay_dict'):
  113. params['material_name'] = self.material_name.to_alipay_dict()
  114. else:
  115. params['material_name'] = self.material_name
  116. if self.material_type:
  117. if hasattr(self.material_type, 'to_alipay_dict'):
  118. params['material_type'] = self.material_type.to_alipay_dict()
  119. else:
  120. params['material_type'] = self.material_type
  121. if self.max_num:
  122. if hasattr(self.max_num, 'to_alipay_dict'):
  123. params['max_num'] = self.max_num.to_alipay_dict()
  124. else:
  125. params['max_num'] = self.max_num
  126. if self.merchant_id:
  127. if hasattr(self.merchant_id, 'to_alipay_dict'):
  128. params['merchant_id'] = self.merchant_id.to_alipay_dict()
  129. else:
  130. params['merchant_id'] = self.merchant_id
  131. if self.public_id:
  132. if hasattr(self.public_id, 'to_alipay_dict'):
  133. params['public_id'] = self.public_id.to_alipay_dict()
  134. else:
  135. params['public_id'] = self.public_id
  136. if self.update_user:
  137. if hasattr(self.update_user, 'to_alipay_dict'):
  138. params['update_user'] = self.update_user.to_alipay_dict()
  139. else:
  140. params['update_user'] = self.update_user
  141. return params
  142. @staticmethod
  143. def from_alipay_dict(d):
  144. if not d:
  145. return None
  146. o = KbdishMaterialInfo()
  147. if 'add_price' in d:
  148. o.add_price = d['add_price']
  149. if 'create_user' in d:
  150. o.create_user = d['create_user']
  151. if 'ext_info' in d:
  152. o.ext_info = d['ext_info']
  153. if 'material_id' in d:
  154. o.material_id = d['material_id']
  155. if 'material_img' in d:
  156. o.material_img = d['material_img']
  157. if 'material_name' in d:
  158. o.material_name = d['material_name']
  159. if 'material_type' in d:
  160. o.material_type = d['material_type']
  161. if 'max_num' in d:
  162. o.max_num = d['max_num']
  163. if 'merchant_id' in d:
  164. o.merchant_id = d['merchant_id']
  165. if 'public_id' in d:
  166. o.public_id = d['public_id']
  167. if 'update_user' in d:
  168. o.update_user = d['update_user']
  169. return o