McardStylInfo.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 McardStylInfo(object):
  6. def __init__(self):
  7. self._background_id = None
  8. self._bg_color = None
  9. self._logo_id = None
  10. @property
  11. def background_id(self):
  12. return self._background_id
  13. @background_id.setter
  14. def background_id(self, value):
  15. self._background_id = value
  16. @property
  17. def bg_color(self):
  18. return self._bg_color
  19. @bg_color.setter
  20. def bg_color(self, value):
  21. self._bg_color = value
  22. @property
  23. def logo_id(self):
  24. return self._logo_id
  25. @logo_id.setter
  26. def logo_id(self, value):
  27. self._logo_id = value
  28. def to_alipay_dict(self):
  29. params = dict()
  30. if self.background_id:
  31. if hasattr(self.background_id, 'to_alipay_dict'):
  32. params['background_id'] = self.background_id.to_alipay_dict()
  33. else:
  34. params['background_id'] = self.background_id
  35. if self.bg_color:
  36. if hasattr(self.bg_color, 'to_alipay_dict'):
  37. params['bg_color'] = self.bg_color.to_alipay_dict()
  38. else:
  39. params['bg_color'] = self.bg_color
  40. if self.logo_id:
  41. if hasattr(self.logo_id, 'to_alipay_dict'):
  42. params['logo_id'] = self.logo_id.to_alipay_dict()
  43. else:
  44. params['logo_id'] = self.logo_id
  45. return params
  46. @staticmethod
  47. def from_alipay_dict(d):
  48. if not d:
  49. return None
  50. o = McardStylInfo()
  51. if 'background_id' in d:
  52. o.background_id = d['background_id']
  53. if 'bg_color' in d:
  54. o.bg_color = d['bg_color']
  55. if 'logo_id' in d:
  56. o.logo_id = d['logo_id']
  57. return o