ActivityStat.py 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class ActivityStat(object):
  6. def __init__(self):
  7. self._contract_count = None
  8. self._finished_count = None
  9. self._lose_efficacy_count = None
  10. self._participator_count = None
  11. self._promising_count = None
  12. self._trade_count = None
  13. self._violated_count = None
  14. @property
  15. def contract_count(self):
  16. return self._contract_count
  17. @contract_count.setter
  18. def contract_count(self, value):
  19. self._contract_count = value
  20. @property
  21. def finished_count(self):
  22. return self._finished_count
  23. @finished_count.setter
  24. def finished_count(self, value):
  25. self._finished_count = value
  26. @property
  27. def lose_efficacy_count(self):
  28. return self._lose_efficacy_count
  29. @lose_efficacy_count.setter
  30. def lose_efficacy_count(self, value):
  31. self._lose_efficacy_count = value
  32. @property
  33. def participator_count(self):
  34. return self._participator_count
  35. @participator_count.setter
  36. def participator_count(self, value):
  37. self._participator_count = value
  38. @property
  39. def promising_count(self):
  40. return self._promising_count
  41. @promising_count.setter
  42. def promising_count(self, value):
  43. self._promising_count = value
  44. @property
  45. def trade_count(self):
  46. return self._trade_count
  47. @trade_count.setter
  48. def trade_count(self, value):
  49. self._trade_count = value
  50. @property
  51. def violated_count(self):
  52. return self._violated_count
  53. @violated_count.setter
  54. def violated_count(self, value):
  55. self._violated_count = value
  56. def to_alipay_dict(self):
  57. params = dict()
  58. if self.contract_count:
  59. if hasattr(self.contract_count, 'to_alipay_dict'):
  60. params['contract_count'] = self.contract_count.to_alipay_dict()
  61. else:
  62. params['contract_count'] = self.contract_count
  63. if self.finished_count:
  64. if hasattr(self.finished_count, 'to_alipay_dict'):
  65. params['finished_count'] = self.finished_count.to_alipay_dict()
  66. else:
  67. params['finished_count'] = self.finished_count
  68. if self.lose_efficacy_count:
  69. if hasattr(self.lose_efficacy_count, 'to_alipay_dict'):
  70. params['lose_efficacy_count'] = self.lose_efficacy_count.to_alipay_dict()
  71. else:
  72. params['lose_efficacy_count'] = self.lose_efficacy_count
  73. if self.participator_count:
  74. if hasattr(self.participator_count, 'to_alipay_dict'):
  75. params['participator_count'] = self.participator_count.to_alipay_dict()
  76. else:
  77. params['participator_count'] = self.participator_count
  78. if self.promising_count:
  79. if hasattr(self.promising_count, 'to_alipay_dict'):
  80. params['promising_count'] = self.promising_count.to_alipay_dict()
  81. else:
  82. params['promising_count'] = self.promising_count
  83. if self.trade_count:
  84. if hasattr(self.trade_count, 'to_alipay_dict'):
  85. params['trade_count'] = self.trade_count.to_alipay_dict()
  86. else:
  87. params['trade_count'] = self.trade_count
  88. if self.violated_count:
  89. if hasattr(self.violated_count, 'to_alipay_dict'):
  90. params['violated_count'] = self.violated_count.to_alipay_dict()
  91. else:
  92. params['violated_count'] = self.violated_count
  93. return params
  94. @staticmethod
  95. def from_alipay_dict(d):
  96. if not d:
  97. return None
  98. o = ActivityStat()
  99. if 'contract_count' in d:
  100. o.contract_count = d['contract_count']
  101. if 'finished_count' in d:
  102. o.finished_count = d['finished_count']
  103. if 'lose_efficacy_count' in d:
  104. o.lose_efficacy_count = d['lose_efficacy_count']
  105. if 'participator_count' in d:
  106. o.participator_count = d['participator_count']
  107. if 'promising_count' in d:
  108. o.promising_count = d['promising_count']
  109. if 'trade_count' in d:
  110. o.trade_count = d['trade_count']
  111. if 'violated_count' in d:
  112. o.violated_count = d['violated_count']
  113. return o