DiscountByDayModel.py 1.8 KB

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