@@ -24,7 +24,7 @@ public interface WxMpMenuService { | |||||
/** | /** | ||||
* <pre> | * <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> | * </pre> | ||||
*/ | */ | ||||
void menuDelete() throws WxErrorException; | void menuDelete() throws WxErrorException; | ||||
@@ -32,12 +32,12 @@ public interface WxMpMenuService { | |||||
/** | /** | ||||
* <pre> | * <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> | * </pre> | ||||
* | * | ||||
* @param menuid | |||||
* @param menuId 个性化菜单的menuid | |||||
*/ | */ | ||||
void menuDelete(String menuid) throws WxErrorException; | |||||
void menuDelete(String menuId) throws WxErrorException; | |||||
/** | /** | ||||
* <pre> | * <pre> | ||||
@@ -45,10 +45,12 @@ public class WxMpMenuServiceImpl implements WxMpMenuService { | |||||
} | } | ||||
@Override | @Override | ||||
public void menuDelete(String menuid) throws WxErrorException { | |||||
public void menuDelete(String menuId) throws WxErrorException { | |||||
String url = API_URL_PREFIX + "/delconditional"; | 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 | @Override | ||||
@@ -70,7 +72,7 @@ public class WxMpMenuServiceImpl implements WxMpMenuService { | |||||
public WxMenu menuTryMatch(String userid) throws WxErrorException { | public WxMenu menuTryMatch(String userid) throws WxErrorException { | ||||
String url = API_URL_PREFIX + "/trymatch"; | String url = API_URL_PREFIX + "/trymatch"; | ||||
JsonObject jsonObject = new JsonObject(); | JsonObject jsonObject = new JsonObject(); | ||||
jsonObject.addProperty("user_id",userid); | |||||
jsonObject.addProperty("user_id", userid); | |||||
try { | try { | ||||
String resultContent = this.wxMpService.post(url, jsonObject.toString()); | String resultContent = this.wxMpService.post(url, jsonObject.toString()); | ||||
return WxMenu.fromJson(resultContent); | return WxMenu.fromJson(resultContent); | ||||
@@ -100,6 +100,12 @@ public class WxMpMenuServiceImplTest { | |||||
this.wxService.getMenuService().menuDelete(); | this.wxService.getMenuService().menuDelete(); | ||||
} | } | ||||
@Test | |||||
public void testDeleteConditionalMenu() throws WxErrorException { | |||||
String menuId = "123"; | |||||
this.wxService.getMenuService().menuDelete(menuId); | |||||
} | |||||
@DataProvider(name="menu") | @DataProvider(name="menu") | ||||
public Object[][] getMenu() { | public Object[][] getMenu() { | ||||
WxMenu menu = new WxMenu(); | WxMenu menu = new WxMenu(); | ||||