EduStudentInfoShareResult.py 2.4 KB

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