AntMerchantExpandIndirectActivityCopyModel.py 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class AntMerchantExpandIndirectActivityCopyModel(object):
  6. def __init__(self):
  7. self._copy_contents = None
  8. self._source_smid = None
  9. self._target_smid = None
  10. @property
  11. def copy_contents(self):
  12. return self._copy_contents
  13. @copy_contents.setter
  14. def copy_contents(self, value):
  15. if isinstance(value, list):
  16. self._copy_contents = list()
  17. for i in value:
  18. self._copy_contents.append(i)
  19. @property
  20. def source_smid(self):
  21. return self._source_smid
  22. @source_smid.setter
  23. def source_smid(self, value):
  24. self._source_smid = value
  25. @property
  26. def target_smid(self):
  27. return self._target_smid
  28. @target_smid.setter
  29. def target_smid(self, value):
  30. self._target_smid = value
  31. def to_alipay_dict(self):
  32. params = dict()
  33. if self.copy_contents:
  34. if isinstance(self.copy_contents, list):
  35. for i in range(0, len(self.copy_contents)):
  36. element = self.copy_contents[i]
  37. if hasattr(element, 'to_alipay_dict'):
  38. self.copy_contents[i] = element.to_alipay_dict()
  39. if hasattr(self.copy_contents, 'to_alipay_dict'):
  40. params['copy_contents'] = self.copy_contents.to_alipay_dict()
  41. else:
  42. params['copy_contents'] = self.copy_contents
  43. if self.source_smid:
  44. if hasattr(self.source_smid, 'to_alipay_dict'):
  45. params['source_smid'] = self.source_smid.to_alipay_dict()
  46. else:
  47. params['source_smid'] = self.source_smid
  48. if self.target_smid:
  49. if hasattr(self.target_smid, 'to_alipay_dict'):
  50. params['target_smid'] = self.target_smid.to_alipay_dict()
  51. else:
  52. params['target_smid'] = self.target_smid
  53. return params
  54. @staticmethod
  55. def from_alipay_dict(d):
  56. if not d:
  57. return None
  58. o = AntMerchantExpandIndirectActivityCopyModel()
  59. if 'copy_contents' in d:
  60. o.copy_contents = d['copy_contents']
  61. if 'source_smid' in d:
  62. o.source_smid = d['source_smid']
  63. if 'target_smid' in d:
  64. o.target_smid = d['target_smid']
  65. return o