Skip to content

Commit 41d5966

Browse files
committed
修复删除个性化菜单的接口 #127
1 parent 69aaa74 commit 41d5966

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpMenuService.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,20 @@ public interface WxMpMenuService {
2424
/**
2525
* <pre>
2626
* 自定义菜单删除接口
27-
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=自定义菜单删除接口
27+
* 详情请见: https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141015&token=&lang=zh_CN
2828
* </pre>
2929
*/
3030
void menuDelete() throws WxErrorException;
3131

3232
/**
3333
* <pre>
3434
* 删除个性化菜单接口
35-
* 详情请见: http://mp.weixin.qq.com/wiki/0/c48ccd12b69ae023159b4bfaa7c39c20.html
35+
* 详情请见: https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1455782296&token=&lang=zh_CN
3636
* </pre>
3737
*
38-
* @param menuid
38+
* @param menuId 个性化菜单的menuid
3939
*/
40-
void menuDelete(String menuid) throws WxErrorException;
40+
void menuDelete(String menuId) throws WxErrorException;
4141

4242
/**
4343
* <pre>

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpMenuServiceImpl.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,12 @@ public void menuDelete() throws WxErrorException {
4545
}
4646

4747
@Override
48-
public void menuDelete(String menuid) throws WxErrorException {
48+
public void menuDelete(String menuId) throws WxErrorException {
4949
String url = API_URL_PREFIX + "/delconditional";
50-
String result = this.wxMpService.get(url, "menuid=" + menuid);
51-
log.debug("根据MeunId({})删除菜单结果:{}", menuid, result);
50+
JsonObject jsonObject = new JsonObject();
51+
jsonObject.addProperty("menuid", menuId);
52+
String result = this.wxMpService.post(url, jsonObject.toString());
53+
log.debug("根据MeunId({})删除菜单结果:{}", menuId, result);
5254
}
5355

5456
@Override
@@ -70,7 +72,7 @@ public WxMenu menuGet() throws WxErrorException {
7072
public WxMenu menuTryMatch(String userid) throws WxErrorException {
7173
String url = API_URL_PREFIX + "/trymatch";
7274
JsonObject jsonObject = new JsonObject();
73-
jsonObject.addProperty("user_id",userid);
75+
jsonObject.addProperty("user_id", userid);
7476
try {
7577
String resultContent = this.wxMpService.post(url, jsonObject.toString());
7678
return WxMenu.fromJson(resultContent);

weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpMenuServiceImplTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@ public void testMenuDelete() throws WxErrorException {
100100
this.wxService.getMenuService().menuDelete();
101101
}
102102

103+
@Test
104+
public void testDeleteConditionalMenu() throws WxErrorException {
105+
String menuId = "123";
106+
this.wxService.getMenuService().menuDelete(menuId);
107+
}
108+
103109
@DataProvider(name="menu")
104110
public Object[][] getMenu() {
105111
WxMenu menu = new WxMenu();

0 commit comments

Comments
 (0)