Skip to content

Commit 69aaa74

Browse files
committed
修复menuTryMatch方法,请求方式由get变更为post,#125
1 parent e97c15b commit 69aaa74

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package me.chanjar.weixin.mp.api.impl;
22

3+
import com.google.gson.JsonObject;
34
import me.chanjar.weixin.common.bean.menu.WxMenu;
45
import me.chanjar.weixin.common.exception.WxErrorException;
56
import me.chanjar.weixin.mp.api.WxMpMenuService;
@@ -68,8 +69,10 @@ public WxMenu menuGet() throws WxErrorException {
6869
@Override
6970
public WxMenu menuTryMatch(String userid) throws WxErrorException {
7071
String url = API_URL_PREFIX + "/trymatch";
72+
JsonObject jsonObject = new JsonObject();
73+
jsonObject.addProperty("user_id",userid);
7174
try {
72-
String resultContent = this.wxMpService.get(url, "user_id=" + userid);
75+
String resultContent = this.wxMpService.post(url, jsonObject.toString());
7376
return WxMenu.fromJson(resultContent);
7477
} catch (WxErrorException e) {
7578
// 46003 不存在的菜单数据 46002 不存在的菜单版本

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ public void testMenuCreate(WxMenu wxMenu) throws WxErrorException {
3434

3535
@Test
3636
public void testMenuTryMatch() throws Exception {
37-
//TODO
37+
WxMenu menu = this.wxService.getMenuService().menuTryMatch("...");
38+
System.out.println(menu);
3839
}
3940

4041
@Test

0 commit comments

Comments
 (0)