ZhimaMerchantTestPracticeModel.py 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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.XXXXsdasdasd import XXXXsdasdasd
  6. class ZhimaMerchantTestPracticeModel(object):
  7. def __init__(self):
  8. self._add = None
  9. self._xxxx = None
  10. @property
  11. def add(self):
  12. return self._add
  13. @add.setter
  14. def add(self, value):
  15. if isinstance(value, list):
  16. self._add = list()
  17. for i in value:
  18. self._add.append(i)
  19. @property
  20. def xxxx(self):
  21. return self._xxxx
  22. @xxxx.setter
  23. def xxxx(self, value):
  24. if isinstance(value, XXXXsdasdasd):
  25. self._xxxx = value
  26. else:
  27. self._xxxx = XXXXsdasdasd.from_alipay_dict(value)
  28. def to_alipay_dict(self):
  29. params = dict()
  30. if self.add:
  31. if isinstance(self.add, list):
  32. for i in range(0, len(self.add)):
  33. element = self.add[i]
  34. if hasattr(element, 'to_alipay_dict'):
  35. self.add[i] = element.to_alipay_dict()
  36. if hasattr(self.add, 'to_alipay_dict'):
  37. params['add'] = self.add.to_alipay_dict()
  38. else:
  39. params['add'] = self.add
  40. if self.xxxx:
  41. if hasattr(self.xxxx, 'to_alipay_dict'):
  42. params['xxxx'] = self.xxxx.to_alipay_dict()
  43. else:
  44. params['xxxx'] = self.xxxx
  45. return params
  46. @staticmethod
  47. def from_alipay_dict(d):
  48. if not d:
  49. return None
  50. o = ZhimaMerchantTestPracticeModel()
  51. if 'add' in d:
  52. o.add = d['add']
  53. if 'xxxx' in d:
  54. o.xxxx = d['xxxx']
  55. return o