mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-05-05 05:07:46 +08:00
修复删除个性化菜单的接口 #127
This commit is contained in:
parent
69aaa74eef
commit
41d596654c
@ -24,7 +24,7 @@ public interface WxMpMenuService {
|
||||
/**
|
||||
* <pre>
|
||||
* 自定义菜单删除接口
|
||||
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=自定义菜单删除接口
|
||||
* 详情请见: https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141015&token=&lang=zh_CN
|
||||
* </pre>
|
||||
*/
|
||||
void menuDelete() throws WxErrorException;
|
||||
@ -32,12 +32,12 @@ public interface WxMpMenuService {
|
||||
/**
|
||||
* <pre>
|
||||
* 删除个性化菜单接口
|
||||
* 详情请见: http://mp.weixin.qq.com/wiki/0/c48ccd12b69ae023159b4bfaa7c39c20.html
|
||||
* 详情请见: https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1455782296&token=&lang=zh_CN
|
||||
* </pre>
|
||||
*
|
||||
* @param menuid
|
||||
* @param menuId 个性化菜单的menuid
|
||||
*/
|
||||
void menuDelete(String menuid) throws WxErrorException;
|
||||
void menuDelete(String menuId) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
|
@ -45,10 +45,12 @@ public class WxMpMenuServiceImpl implements WxMpMenuService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void menuDelete(String menuid) throws WxErrorException {
|
||||
public void menuDelete(String menuId) throws WxErrorException {
|
||||
String url = API_URL_PREFIX + "/delconditional";
|
||||
String result = this.wxMpService.get(url, "menuid=" + menuid);
|
||||
log.debug("根据MeunId({})删除菜单结果:{}", menuid, result);
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("menuid", menuId);
|
||||
String result = this.wxMpService.post(url, jsonObject.toString());
|
||||
log.debug("根据MeunId({})删除菜单结果:{}", menuId, result);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -70,7 +72,7 @@ public class WxMpMenuServiceImpl implements WxMpMenuService {
|
||||
public WxMenu menuTryMatch(String userid) throws WxErrorException {
|
||||
String url = API_URL_PREFIX + "/trymatch";
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("user_id",userid);
|
||||
jsonObject.addProperty("user_id", userid);
|
||||
try {
|
||||
String resultContent = this.wxMpService.post(url, jsonObject.toString());
|
||||
return WxMenu.fromJson(resultContent);
|
||||
|
@ -100,6 +100,12 @@ public class WxMpMenuServiceImplTest {
|
||||
this.wxService.getMenuService().menuDelete();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteConditionalMenu() throws WxErrorException {
|
||||
String menuId = "123";
|
||||
this.wxService.getMenuService().menuDelete(menuId);
|
||||
}
|
||||
|
||||
@DataProvider(name="menu")
|
||||
public Object[][] getMenu() {
|
||||
WxMenu menu = new WxMenu();
|
||||
|
Loading…
Reference in New Issue
Block a user