shop.py 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. # -*- coding: utf-8 -*-
  2. # !/usr/bin/env python
  3. from library.jdopen.client.api.base import BaseJdOpenAPI
  4. class JdOpenShop(BaseJdOpenAPI):
  5. def create_shop(
  6. self, customerNum, shopName, address, oneIndustry, twoIndustry,
  7. mobilePhone, mapLng=None, mapLat=None, microBizType=None
  8. ):
  9. """
  10. 创建店铺
  11. """
  12. url = "/v1/agent/declare/shopinfo/create"
  13. data = {
  14. "agentNum": self.agentNum,
  15. "customerNum": customerNum,
  16. "shopName": shopName,
  17. "address": address,
  18. "oneIndustry": oneIndustry,
  19. "twoIndustry": twoIndustry,
  20. "mobilePhone": mobilePhone,
  21. "mapLng": mapLng,
  22. "mapLat": mapLat,
  23. "microBizType": microBizType
  24. }
  25. sendData = {_k: _v for _k, _v in data.items() if _v is not None}
  26. return self._post(url=url, data=sendData)
  27. def modify_shop(
  28. self, shopNum, customerNum, shopName, address, oneIndustry, twoIndustry,
  29. mobilePhone, mapLng = None, mapLat = None, microBizType = None
  30. ):
  31. """
  32. 修改店铺
  33. """
  34. url = "/v1/agent/declare/shopinfo/modify"
  35. data = {
  36. "shopNum": shopNum,
  37. "agentNum": self.agentNum,
  38. "customerNum": customerNum,
  39. "shopName": shopName,
  40. "address": address,
  41. "oneIndustry": oneIndustry,
  42. "twoIndustry": twoIndustry,
  43. "mobilePhone": mobilePhone,
  44. "mapLng": mapLng,
  45. "mapLat": mapLat,
  46. "microBizType": microBizType
  47. }
  48. sendData = {_k: _v for _k, _v in data.items() if _v is not None}
  49. return self._post(url=url, data=sendData)
  50. def get_shop(self, customerNum):
  51. """
  52. 获取店铺信息
  53. """
  54. return self._get(url="/v1/agent/declare/shop/list/{}".format(customerNum))