添加删除门店的接口, for issue #17

This commit is contained in:
BinaryWang 2016-09-28 20:00:55 +08:00
parent 091aefe4e1
commit 460a52be10
3 changed files with 28 additions and 1 deletions

View File

@ -36,11 +36,22 @@ public interface WxMpStoreService {
* 扩展字段为公共编辑信息大家都可修改修改将会审核并决定是否对修改建议进行采纳但不会影响该门店的生效可用状态 * 扩展字段为公共编辑信息大家都可修改修改将会审核并决定是否对修改建议进行采纳但不会影响该门店的生效可用状态
* 详情请见: <a href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444378120&token=&lang=zh_CN">微信门店接口</a> * 详情请见: <a href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444378120&token=&lang=zh_CN">微信门店接口</a>
* </pre> * </pre>
* @param poiId 门店poiId * @param poiId 门店Id
* @throws WxErrorException * @throws WxErrorException
*/ */
WxMpStoreBaseInfo get(String poiId) throws WxErrorException; WxMpStoreBaseInfo get(String poiId) throws WxErrorException;
/**
* <pre>
* 删除门店
* 商户可以通过该接口删除已经成功创建的门店请商户慎重调用该接口
* 详情请见: <a href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444378120&token=&lang=zh_CN">微信门店接口</a>
* </pre>
* @param poiId 门店Id
* @throws WxErrorException
*/
void delete(String poiId) throws WxErrorException;
/** /**
* <pre> * <pre>
* 查询门店列表(指定查询起始位置和个数) * 查询门店列表(指定查询起始位置和个数)

View File

@ -57,6 +57,18 @@ public class WxMpStoreServiceImpl implements WxMpStoreService {
.get("business").getAsJsonObject().get("base_info").toString()); .get("business").getAsJsonObject().get("base_info").toString());
} }
@Override
public void delete(String poiId) throws WxErrorException {
String url = API_BASE_URL + "/delpoi";
JsonObject paramObject = new JsonObject();
paramObject.addProperty("poi_id",poiId);
String response = this.wxMpService.post(url, paramObject.toString());
WxError wxError = WxError.fromJson(response);
if (wxError.getErrorCode() != 0) {
throw new WxErrorException(wxError);
}
}
private void checkParameters(WxMpStoreBaseInfo request) { private void checkParameters(WxMpStoreBaseInfo request) {
List<String> nullFields = Lists.newArrayList(); List<String> nullFields = Lists.newArrayList();
for (Entry<String, Reflect> entry : Reflect.on(request).fields() for (Entry<String, Reflect> entry : Reflect.on(request).fields()

View File

@ -52,6 +52,10 @@ public class WxMpStoreServiceImplTest {
System.err.println(result); System.err.println(result);
} }
public void testDelete() throws WxErrorException {
this.wxMpService.getStoreService().delete("463558057");
}
public void testList() throws WxErrorException { public void testList() throws WxErrorException {
WxMpStoreListResult result = this.wxMpService.getStoreService().list(0, 10); WxMpStoreListResult result = this.wxMpService.getStoreService().list(0, 10);
assertNotNull(result); assertNotNull(result);