修复menuTryMatch方法,请求方式由get变更为post,#125

This commit is contained in:
Binary Wang 2017-01-16 18:12:08 +08:00
parent e97c15b6ce
commit 69aaa74eef
2 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,6 @@
package me.chanjar.weixin.mp.api.impl; package me.chanjar.weixin.mp.api.impl;
import com.google.gson.JsonObject;
import me.chanjar.weixin.common.bean.menu.WxMenu; import me.chanjar.weixin.common.bean.menu.WxMenu;
import me.chanjar.weixin.common.exception.WxErrorException; import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.mp.api.WxMpMenuService; import me.chanjar.weixin.mp.api.WxMpMenuService;
@ -68,8 +69,10 @@ public class WxMpMenuServiceImpl implements WxMpMenuService {
@Override @Override
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.addProperty("user_id",userid);
try { try {
String resultContent = this.wxMpService.get(url, "user_id=" + userid); String resultContent = this.wxMpService.post(url, jsonObject.toString());
return WxMenu.fromJson(resultContent); return WxMenu.fromJson(resultContent);
} catch (WxErrorException e) { } catch (WxErrorException e) {
// 46003 不存在的菜单数据 46002 不存在的菜单版本 // 46003 不存在的菜单数据 46002 不存在的菜单版本

View File

@ -34,7 +34,8 @@ public class WxMpMenuServiceImplTest {
@Test @Test
public void testMenuTryMatch() throws Exception { public void testMenuTryMatch() throws Exception {
//TODO WxMenu menu = this.wxService.getMenuService().menuTryMatch("...");
System.out.println(menu);
} }
@Test @Test