Quellcode durchsuchen

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

master
BinaryWang vor 8 Jahren
Ursprung
Commit
460a52be10
3 geänderte Dateien mit 28 neuen und 1 gelöschten Zeilen
  1. +12
    -1
      weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpStoreService.java
  2. +12
    -0
      weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpStoreServiceImpl.java
  3. +4
    -0
      weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpStoreServiceImplTest.java

+ 12
- 1
weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpStoreService.java Datei anzeigen

@@ -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>
* </pre>
* @param poiId 门店poiId
* @param poiId 门店Id
* @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>
* 查询门店列表(指定查询起始位置和个数)


+ 12
- 0
weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpStoreServiceImpl.java Datei anzeigen

@@ -57,6 +57,18 @@ public class WxMpStoreServiceImpl implements WxMpStoreService {
.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) {
List<String> nullFields = Lists.newArrayList();
for (Entry<String, Reflect> entry : Reflect.on(request).fields()


+ 4
- 0
weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpStoreServiceImplTest.java Datei anzeigen

@@ -52,6 +52,10 @@ public class WxMpStoreServiceImplTest {
System.err.println(result);
}

public void testDelete() throws WxErrorException {
this.wxMpService.getStoreService().delete("463558057");
}

public void testList() throws WxErrorException {
WxMpStoreListResult result = this.wxMpService.getStoreService().list(0, 10);
assertNotNull(result);


Laden…
Abbrechen
Speichern