CrowdConstraintInfo.py 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class CrowdConstraintInfo(object):
  6. def __init__(self):
  7. self._crowd_condition = None
  8. self._crowd_name = None
  9. self._crowd_restriction = None
  10. @property
  11. def crowd_condition(self):
  12. return self._crowd_condition
  13. @crowd_condition.setter
  14. def crowd_condition(self, value):
  15. self._crowd_condition = value
  16. @property
  17. def crowd_name(self):
  18. return self._crowd_name
  19. @crowd_name.setter
  20. def crowd_name(self, value):
  21. self._crowd_name = value
  22. @property
  23. def crowd_restriction(self):
  24. return self._crowd_restriction
  25. @crowd_restriction.setter
  26. def crowd_restriction(self, value):
  27. self._crowd_restriction = value
  28. def to_alipay_dict(self):
  29. params = dict()
  30. if self.crowd_condition:
  31. if hasattr(self.crowd_condition, 'to_alipay_dict'):
  32. params['crowd_condition'] = self.crowd_condition.to_alipay_dict()
  33. else:
  34. params['crowd_condition'] = self.crowd_condition
  35. if self.crowd_name:
  36. if hasattr(self.crowd_name, 'to_alipay_dict'):
  37. params['crowd_name'] = self.crowd_name.to_alipay_dict()
  38. else:
  39. params['crowd_name'] = self.crowd_name
  40. if self.crowd_restriction:
  41. if hasattr(self.crowd_restriction, 'to_alipay_dict'):
  42. params['crowd_restriction'] = self.crowd_restriction.to_alipay_dict()
  43. else:
  44. params['crowd_restriction'] = self.crowd_restriction
  45. return params
  46. @staticmethod
  47. def from_alipay_dict(d):
  48. if not d:
  49. return None
  50. o = CrowdConstraintInfo()
  51. if 'crowd_condition' in d:
  52. o.crowd_condition = d['crowd_condition']
  53. if 'crowd_name' in d:
  54. o.crowd_name = d['crowd_name']
  55. if 'crowd_restriction' in d:
  56. o.crowd_restriction = d['crowd_restriction']
  57. return o