Files
test/sg_wechat_enterprise/we_api/client/api/poi.py
2024-07-10 15:58:47 +08:00

98 lines
2.6 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from wechatpy.client.api.base import BaseWeChatAPI
class WeChatPoi(BaseWeChatAPI):
def add_picture(self, access_token, buffer):
"""
上传图片接口
:param access_token: 接口凭证
:param buffer: buffer
:return:
详情请参考: https://mp.weixin.qq.com/wiki/16/8f182af4d8dcea02c56506306bdb2f4c.html
"""
def add(self, poi_data):
"""
创建门店
详情请参考
http://mp.weixin.qq.com/wiki/16/8f182af4d8dcea02c56506306bdb2f4c.html
:param poi_data: 门店信息字典
:return: 返回的 JSON 数据包
"""
return self._post('poi/addpoi', data=poi_data)
def get(self, poi_id):
"""
查询门店信息
详情请参考
http://mp.weixin.qq.com/wiki/16/8f182af4d8dcea02c56506306bdb2f4c.html
:param poi_id: 门店 ID
:return: 返回的 JSON 数据包
"""
return self._post('poi/getpoi', data={'poi_id': poi_id})
def list(self, begin=0, limit=20):
"""
查询门店列表
详情请参考
http://mp.weixin.qq.com/wiki/16/8f182af4d8dcea02c56506306bdb2f4c.html
:param begin: 开始位置0 即为从第一条开始查询
:param limit: 返回数据条数最大允许50默认为20
:return: 返回的 JSON 数据包
"""
return self._post(
'poi/getpoilist',
data={
'begin': begin,
'limit': limit,
}
)
def update(self, poi_data):
"""
修改门店
详情请参考
http://mp.weixin.qq.com/wiki/16/8f182af4d8dcea02c56506306bdb2f4c.html
:param poi_data: 门店信息字典
:return: 返回的 JSON 数据包
"""
return self._post('poi/updatepoi', data=poi_data)
def delete(self, poi_id):
"""
删除门店
详情请参考
http://mp.weixin.qq.com/wiki/16/8f182af4d8dcea02c56506306bdb2f4c.html
:param poi_id: 门店 ID
:return: 返回的 JSON 数据包
"""
return self._post('poi/delpoi', data={'poi_id': poi_id})
def get_categories(self):
"""
获取微信门店类目表
详情请参考
http://mp.weixin.qq.com/wiki/16/8f182af4d8dcea02c56506306bdb2f4c.html
:return: 门店类目表
"""
res = self._get(
'api_getwxcategory',
result_processor=lambda x: x['category_list']
)
return res