ShopPromoInfo.py 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  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.PromoVoucherInfo import PromoVoucherInfo
  6. class ShopPromoInfo(object):
  7. def __init__(self):
  8. self._action_param = None
  9. self._address = None
  10. self._brand_name = None
  11. self._city_id = None
  12. self._cuisine = None
  13. self._ext_info = None
  14. self._has_hui = None
  15. self._head_shop_name = None
  16. self._latitude = None
  17. self._longitude = None
  18. self._popularity = None
  19. self._popularity_level = None
  20. self._price_average = None
  21. self._root_display_category_info = None
  22. self._shop_id = None
  23. self._shop_logo_url = None
  24. self._shop_name = None
  25. self._shop_recommend_one_tag_compose = None
  26. self._voucher_info_list = None
  27. @property
  28. def action_param(self):
  29. return self._action_param
  30. @action_param.setter
  31. def action_param(self, value):
  32. self._action_param = value
  33. @property
  34. def address(self):
  35. return self._address
  36. @address.setter
  37. def address(self, value):
  38. self._address = value
  39. @property
  40. def brand_name(self):
  41. return self._brand_name
  42. @brand_name.setter
  43. def brand_name(self, value):
  44. self._brand_name = value
  45. @property
  46. def city_id(self):
  47. return self._city_id
  48. @city_id.setter
  49. def city_id(self, value):
  50. self._city_id = value
  51. @property
  52. def cuisine(self):
  53. return self._cuisine
  54. @cuisine.setter
  55. def cuisine(self, value):
  56. self._cuisine = value
  57. @property
  58. def ext_info(self):
  59. return self._ext_info
  60. @ext_info.setter
  61. def ext_info(self, value):
  62. self._ext_info = value
  63. @property
  64. def has_hui(self):
  65. return self._has_hui
  66. @has_hui.setter
  67. def has_hui(self, value):
  68. self._has_hui = value
  69. @property
  70. def head_shop_name(self):
  71. return self._head_shop_name
  72. @head_shop_name.setter
  73. def head_shop_name(self, value):
  74. self._head_shop_name = value
  75. @property
  76. def latitude(self):
  77. return self._latitude
  78. @latitude.setter
  79. def latitude(self, value):
  80. self._latitude = value
  81. @property
  82. def longitude(self):
  83. return self._longitude
  84. @longitude.setter
  85. def longitude(self, value):
  86. self._longitude = value
  87. @property
  88. def popularity(self):
  89. return self._popularity
  90. @popularity.setter
  91. def popularity(self, value):
  92. self._popularity = value
  93. @property
  94. def popularity_level(self):
  95. return self._popularity_level
  96. @popularity_level.setter
  97. def popularity_level(self, value):
  98. self._popularity_level = value
  99. @property
  100. def price_average(self):
  101. return self._price_average
  102. @price_average.setter
  103. def price_average(self, value):
  104. self._price_average = value
  105. @property
  106. def root_display_category_info(self):
  107. return self._root_display_category_info
  108. @root_display_category_info.setter
  109. def root_display_category_info(self, value):
  110. self._root_display_category_info = value
  111. @property
  112. def shop_id(self):
  113. return self._shop_id
  114. @shop_id.setter
  115. def shop_id(self, value):
  116. self._shop_id = value
  117. @property
  118. def shop_logo_url(self):
  119. return self._shop_logo_url
  120. @shop_logo_url.setter
  121. def shop_logo_url(self, value):
  122. self._shop_logo_url = value
  123. @property
  124. def shop_name(self):
  125. return self._shop_name
  126. @shop_name.setter
  127. def shop_name(self, value):
  128. self._shop_name = value
  129. @property
  130. def shop_recommend_one_tag_compose(self):
  131. return self._shop_recommend_one_tag_compose
  132. @shop_recommend_one_tag_compose.setter
  133. def shop_recommend_one_tag_compose(self, value):
  134. self._shop_recommend_one_tag_compose = value
  135. @property
  136. def voucher_info_list(self):
  137. return self._voucher_info_list
  138. @voucher_info_list.setter
  139. def voucher_info_list(self, value):
  140. if isinstance(value, list):
  141. self._voucher_info_list = list()
  142. for i in value:
  143. if isinstance(i, PromoVoucherInfo):
  144. self._voucher_info_list.append(i)
  145. else:
  146. self._voucher_info_list.append(PromoVoucherInfo.from_alipay_dict(i))
  147. def to_alipay_dict(self):
  148. params = dict()
  149. if self.action_param:
  150. if hasattr(self.action_param, 'to_alipay_dict'):
  151. params['action_param'] = self.action_param.to_alipay_dict()
  152. else:
  153. params['action_param'] = self.action_param
  154. if self.address:
  155. if hasattr(self.address, 'to_alipay_dict'):
  156. params['address'] = self.address.to_alipay_dict()
  157. else:
  158. params['address'] = self.address
  159. if self.brand_name:
  160. if hasattr(self.brand_name, 'to_alipay_dict'):
  161. params['brand_name'] = self.brand_name.to_alipay_dict()
  162. else:
  163. params['brand_name'] = self.brand_name
  164. if self.city_id:
  165. if hasattr(self.city_id, 'to_alipay_dict'):
  166. params['city_id'] = self.city_id.to_alipay_dict()
  167. else:
  168. params['city_id'] = self.city_id
  169. if self.cuisine:
  170. if hasattr(self.cuisine, 'to_alipay_dict'):
  171. params['cuisine'] = self.cuisine.to_alipay_dict()
  172. else:
  173. params['cuisine'] = self.cuisine
  174. if self.ext_info:
  175. if hasattr(self.ext_info, 'to_alipay_dict'):
  176. params['ext_info'] = self.ext_info.to_alipay_dict()
  177. else:
  178. params['ext_info'] = self.ext_info
  179. if self.has_hui:
  180. if hasattr(self.has_hui, 'to_alipay_dict'):
  181. params['has_hui'] = self.has_hui.to_alipay_dict()
  182. else:
  183. params['has_hui'] = self.has_hui
  184. if self.head_shop_name:
  185. if hasattr(self.head_shop_name, 'to_alipay_dict'):
  186. params['head_shop_name'] = self.head_shop_name.to_alipay_dict()
  187. else:
  188. params['head_shop_name'] = self.head_shop_name
  189. if self.latitude:
  190. if hasattr(self.latitude, 'to_alipay_dict'):
  191. params['latitude'] = self.latitude.to_alipay_dict()
  192. else:
  193. params['latitude'] = self.latitude
  194. if self.longitude:
  195. if hasattr(self.longitude, 'to_alipay_dict'):
  196. params['longitude'] = self.longitude.to_alipay_dict()
  197. else:
  198. params['longitude'] = self.longitude
  199. if self.popularity:
  200. if hasattr(self.popularity, 'to_alipay_dict'):
  201. params['popularity'] = self.popularity.to_alipay_dict()
  202. else:
  203. params['popularity'] = self.popularity
  204. if self.popularity_level:
  205. if hasattr(self.popularity_level, 'to_alipay_dict'):
  206. params['popularity_level'] = self.popularity_level.to_alipay_dict()
  207. else:
  208. params['popularity_level'] = self.popularity_level
  209. if self.price_average:
  210. if hasattr(self.price_average, 'to_alipay_dict'):
  211. params['price_average'] = self.price_average.to_alipay_dict()
  212. else:
  213. params['price_average'] = self.price_average
  214. if self.root_display_category_info:
  215. if hasattr(self.root_display_category_info, 'to_alipay_dict'):
  216. params['root_display_category_info'] = self.root_display_category_info.to_alipay_dict()
  217. else:
  218. params['root_display_category_info'] = self.root_display_category_info
  219. if self.shop_id:
  220. if hasattr(self.shop_id, 'to_alipay_dict'):
  221. params['shop_id'] = self.shop_id.to_alipay_dict()
  222. else:
  223. params['shop_id'] = self.shop_id
  224. if self.shop_logo_url:
  225. if hasattr(self.shop_logo_url, 'to_alipay_dict'):
  226. params['shop_logo_url'] = self.shop_logo_url.to_alipay_dict()
  227. else:
  228. params['shop_logo_url'] = self.shop_logo_url
  229. if self.shop_name:
  230. if hasattr(self.shop_name, 'to_alipay_dict'):
  231. params['shop_name'] = self.shop_name.to_alipay_dict()
  232. else:
  233. params['shop_name'] = self.shop_name
  234. if self.shop_recommend_one_tag_compose:
  235. if hasattr(self.shop_recommend_one_tag_compose, 'to_alipay_dict'):
  236. params['shop_recommend_one_tag_compose'] = self.shop_recommend_one_tag_compose.to_alipay_dict()
  237. else:
  238. params['shop_recommend_one_tag_compose'] = self.shop_recommend_one_tag_compose
  239. if self.voucher_info_list:
  240. if isinstance(self.voucher_info_list, list):
  241. for i in range(0, len(self.voucher_info_list)):
  242. element = self.voucher_info_list[i]
  243. if hasattr(element, 'to_alipay_dict'):
  244. self.voucher_info_list[i] = element.to_alipay_dict()
  245. if hasattr(self.voucher_info_list, 'to_alipay_dict'):
  246. params['voucher_info_list'] = self.voucher_info_list.to_alipay_dict()
  247. else:
  248. params['voucher_info_list'] = self.voucher_info_list
  249. return params
  250. @staticmethod
  251. def from_alipay_dict(d):
  252. if not d:
  253. return None
  254. o = ShopPromoInfo()
  255. if 'action_param' in d:
  256. o.action_param = d['action_param']
  257. if 'address' in d:
  258. o.address = d['address']
  259. if 'brand_name' in d:
  260. o.brand_name = d['brand_name']
  261. if 'city_id' in d:
  262. o.city_id = d['city_id']
  263. if 'cuisine' in d:
  264. o.cuisine = d['cuisine']
  265. if 'ext_info' in d:
  266. o.ext_info = d['ext_info']
  267. if 'has_hui' in d:
  268. o.has_hui = d['has_hui']
  269. if 'head_shop_name' in d:
  270. o.head_shop_name = d['head_shop_name']
  271. if 'latitude' in d:
  272. o.latitude = d['latitude']
  273. if 'longitude' in d:
  274. o.longitude = d['longitude']
  275. if 'popularity' in d:
  276. o.popularity = d['popularity']
  277. if 'popularity_level' in d:
  278. o.popularity_level = d['popularity_level']
  279. if 'price_average' in d:
  280. o.price_average = d['price_average']
  281. if 'root_display_category_info' in d:
  282. o.root_display_category_info = d['root_display_category_info']
  283. if 'shop_id' in d:
  284. o.shop_id = d['shop_id']
  285. if 'shop_logo_url' in d:
  286. o.shop_logo_url = d['shop_logo_url']
  287. if 'shop_name' in d:
  288. o.shop_name = d['shop_name']
  289. if 'shop_recommend_one_tag_compose' in d:
  290. o.shop_recommend_one_tag_compose = d['shop_recommend_one_tag_compose']
  291. if 'voucher_info_list' in d:
  292. o.voucher_info_list = d['voucher_info_list']
  293. return o