mirror of
				https://gitee.com/binary/weixin-java-tools.git
				synced 2025-11-01 03:25:35 +08:00 
			
		
		
		
	修复menuTryMatch方法,请求方式由get变更为post,#125
This commit is contained in:
		| @ -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 不存在的菜单版本 | ||||||
|  | |||||||
| @ -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 | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Binary Wang
					Binary Wang