mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-08-23 13:06:54 +08:00
添加查询门店类目列表的接口, for issue #17
This commit is contained in:
parent
460a52be10
commit
8a5fdb1717
@ -35,6 +35,7 @@ public interface WxMpStoreService {
|
||||
* 最终结果会在5 个工作日内,最终确认是否采纳,并前端生效(但该扩展字段的采纳过程不影响门店的可用性,即available_state仍为审核通过状态)
|
||||
* 注:扩展字段为公共编辑信息(大家都可修改),修改将会审核,并决定是否对修改建议进行采纳,但不会影响该门店的生效可用状态。
|
||||
* 详情请见: <a href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444378120&token=&lang=zh_CN">微信门店接口</a>
|
||||
* 接口格式:http://api.weixin.qq.com/cgi-bin/poi/getpoi?access_token=TOKEN
|
||||
* </pre>
|
||||
* @param poiId 门店Id
|
||||
* @throws WxErrorException
|
||||
@ -46,6 +47,7 @@ public interface WxMpStoreService {
|
||||
* 删除门店
|
||||
* 商户可以通过该接口,删除已经成功创建的门店。请商户慎重调用该接口。
|
||||
* 详情请见: <a href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444378120&token=&lang=zh_CN">微信门店接口</a>
|
||||
* 接口格式:http://api.weixin.qq.com/cgi-bin/poi/delpoi?access_token=TOKEN
|
||||
* </pre>
|
||||
* @param poiId 门店Id
|
||||
* @throws WxErrorException
|
||||
@ -57,6 +59,7 @@ public interface WxMpStoreService {
|
||||
* 查询门店列表(指定查询起始位置和个数)
|
||||
* 商户可以通过该接口,批量查询自己名下的门店list,并获取已审核通过的poi_id(所有状态均会返回poi_id,但该poi_id不一定为最终id)、商户自身sid 用于对应、商户名、分店名、地址字段。
|
||||
* 详情请见: <a href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444378120&token=&lang=zh_CN">微信门店接口</a>
|
||||
* 接口格式:http://api.weixin.qq.com/cgi-bin/poi/getpoilist?access_token=TOKEN
|
||||
* </pre>
|
||||
* @param begin 开始位置,0 即为从第一条开始查询
|
||||
* @param limit 返回数据条数,最大允许50,默认为20
|
||||
@ -69,6 +72,7 @@ public interface WxMpStoreService {
|
||||
* 查询门店列表(所有)
|
||||
* 商户可以通过该接口,批量查询自己名下的门店list,并获取已审核通过的poi_id(所有状态均会返回poi_id,但该poi_id不一定为最终id)、商户自身sid 用于对应、商户名、分店名、地址字段。
|
||||
* 详情请见: <a href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444378120&token=&lang=zh_CN">微信门店接口</a>
|
||||
* 接口格式:http://api.weixin.qq.com/cgi-bin/poi/getpoilist?access_token=TOKEN
|
||||
* </pre>
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
@ -79,9 +83,21 @@ public interface WxMpStoreService {
|
||||
* 修改门店服务信息
|
||||
* 商户可以通过该接口,修改门店的服务信息,包括:sid、图片列表、营业时间、推荐、特色服务、简介、人均价格、电话8个字段(名称、坐标、地址等不可修改)修改后需要人工审核。
|
||||
* 详情请见: <a href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444378120&token=&lang=zh_CN">微信门店接口</a>
|
||||
* 接口格式:http://api.weixin.qq.com/cgi-bin/poi/updatepoi?access_token=TOKEN
|
||||
* </pre>
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
void update(WxMpStoreBaseInfo info) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 门店类目表
|
||||
* 类目名称接口是为商户提供自己门店类型信息的接口。门店类目定位的越规范,能够精准的吸引更多用户,提高曝光率。
|
||||
* 详情请见: <a href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444378120&token=&lang=zh_CN">微信门店接口</a>
|
||||
* 接口格式:http://api.weixin.qq.com/cgi-bin/poi/getwxcategory?access_token=TOKEN
|
||||
* </pre>
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
List<String> listCategories() throws WxErrorException;
|
||||
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package me.chanjar.weixin.mp.api.impl;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import me.chanjar.weixin.common.annotation.Required;
|
||||
import me.chanjar.weixin.common.bean.result.WxError;
|
||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||
@ -11,6 +12,7 @@ import me.chanjar.weixin.mp.api.WxMpStoreService;
|
||||
import me.chanjar.weixin.mp.bean.store.WxMpStoreBaseInfo;
|
||||
import me.chanjar.weixin.mp.bean.store.WxMpStoreInfo;
|
||||
import me.chanjar.weixin.mp.bean.store.WxMpStoreListResult;
|
||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
import org.joor.Reflect;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
@ -139,4 +141,18 @@ public class WxMpStoreServiceImpl implements WxMpStoreService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> listCategories() throws WxErrorException {
|
||||
String url = API_BASE_URL + "/getwxcategory";
|
||||
String response = this.wxMpService.get(url, null);
|
||||
WxError wxError = WxError.fromJson(response);
|
||||
if (wxError.getErrorCode() != 0) {
|
||||
throw new WxErrorException(wxError);
|
||||
}
|
||||
|
||||
return WxMpGsonBuilder.create().fromJson(
|
||||
new JsonParser().parse(response).getAsJsonObject().get("category_list"),
|
||||
new TypeToken<List<String>>(){}.getType());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -56,6 +56,12 @@ public class WxMpStoreServiceImplTest {
|
||||
this.wxMpService.getStoreService().delete("463558057");
|
||||
}
|
||||
|
||||
public void testListCategories() throws WxErrorException {
|
||||
List<String> result = this.wxMpService.getStoreService().listCategories();
|
||||
assertNotNull(result);
|
||||
System.err.println(result);
|
||||
}
|
||||
|
||||
public void testList() throws WxErrorException {
|
||||
WxMpStoreListResult result = this.wxMpService.getStoreService().list(0, 10);
|
||||
assertNotNull(result);
|
||||
|
Loading…
Reference in New Issue
Block a user