Dishes.py 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class Dishes(object):
  6. def __init__(self):
  7. self._dish_id = None
  8. self._dish_name = None
  9. self._dish_num = None
  10. self._dish_price = None
  11. self._dish_real_price = None
  12. self._dish_skuid = None
  13. @property
  14. def dish_id(self):
  15. return self._dish_id
  16. @dish_id.setter
  17. def dish_id(self, value):
  18. self._dish_id = value
  19. @property
  20. def dish_name(self):
  21. return self._dish_name
  22. @dish_name.setter
  23. def dish_name(self, value):
  24. self._dish_name = value
  25. @property
  26. def dish_num(self):
  27. return self._dish_num
  28. @dish_num.setter
  29. def dish_num(self, value):
  30. self._dish_num = value
  31. @property
  32. def dish_price(self):
  33. return self._dish_price
  34. @dish_price.setter
  35. def dish_price(self, value):
  36. self._dish_price = value
  37. @property
  38. def dish_real_price(self):
  39. return self._dish_real_price
  40. @dish_real_price.setter
  41. def dish_real_price(self, value):
  42. self._dish_real_price = value
  43. @property
  44. def dish_skuid(self):
  45. return self._dish_skuid
  46. @dish_skuid.setter
  47. def dish_skuid(self, value):
  48. self._dish_skuid = value
  49. def to_alipay_dict(self):
  50. params = dict()
  51. if self.dish_id:
  52. if hasattr(self.dish_id, 'to_alipay_dict'):
  53. params['dish_id'] = self.dish_id.to_alipay_dict()
  54. else:
  55. params['dish_id'] = self.dish_id
  56. if self.dish_name:
  57. if hasattr(self.dish_name, 'to_alipay_dict'):
  58. params['dish_name'] = self.dish_name.to_alipay_dict()
  59. else:
  60. params['dish_name'] = self.dish_name
  61. if self.dish_num:
  62. if hasattr(self.dish_num, 'to_alipay_dict'):
  63. params['dish_num'] = self.dish_num.to_alipay_dict()
  64. else:
  65. params['dish_num'] = self.dish_num
  66. if self.dish_price:
  67. if hasattr(self.dish_price, 'to_alipay_dict'):
  68. params['dish_price'] = self.dish_price.to_alipay_dict()
  69. else:
  70. params['dish_price'] = self.dish_price
  71. if self.dish_real_price:
  72. if hasattr(self.dish_real_price, 'to_alipay_dict'):
  73. params['dish_real_price'] = self.dish_real_price.to_alipay_dict()
  74. else:
  75. params['dish_real_price'] = self.dish_real_price
  76. if self.dish_skuid:
  77. if hasattr(self.dish_skuid, 'to_alipay_dict'):
  78. params['dish_skuid'] = self.dish_skuid.to_alipay_dict()
  79. else:
  80. params['dish_skuid'] = self.dish_skuid
  81. return params
  82. @staticmethod
  83. def from_alipay_dict(d):
  84. if not d:
  85. return None
  86. o = Dishes()
  87. if 'dish_id' in d:
  88. o.dish_id = d['dish_id']
  89. if 'dish_name' in d:
  90. o.dish_name = d['dish_name']
  91. if 'dish_num' in d:
  92. o.dish_num = d['dish_num']
  93. if 'dish_price' in d:
  94. o.dish_price = d['dish_price']
  95. if 'dish_real_price' in d:
  96. o.dish_real_price = d['dish_real_price']
  97. if 'dish_skuid' in d:
  98. o.dish_skuid = d['dish_skuid']
  99. return o