mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-08-24 16:18:51 +08:00
修复menuTryMatch方法,请求方式由get变更为post,#125
This commit is contained in:
parent
e97c15b6ce
commit
69aaa74eef
@ -1,5 +1,6 @@
|
||||
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.exception.WxErrorException;
|
||||
import me.chanjar.weixin.mp.api.WxMpMenuService;
|
||||
@ -68,8 +69,10 @@ public class WxMpMenuServiceImpl implements WxMpMenuService {
|
||||
@Override
|
||||
public WxMenu menuTryMatch(String userid) throws WxErrorException {
|
||||
String url = API_URL_PREFIX + "/trymatch";
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("user_id",userid);
|
||||
try {
|
||||
String resultContent = this.wxMpService.get(url, "user_id=" + userid);
|
||||
String resultContent = this.wxMpService.post(url, jsonObject.toString());
|
||||
return WxMenu.fromJson(resultContent);
|
||||
} catch (WxErrorException e) {
|
||||
// 46003 不存在的菜单数据 46002 不存在的菜单版本
|
||||
|
@ -34,7 +34,8 @@ public class WxMpMenuServiceImplTest {
|
||||
|
||||
@Test
|
||||
public void testMenuTryMatch() throws Exception {
|
||||
//TODO
|
||||
WxMenu menu = this.wxService.getMenuService().menuTryMatch("...");
|
||||
System.out.println(menu);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user