mirror of
				https://gitee.com/binary/weixin-java-tools.git
				synced 2025-10-31 18:46:10 +08:00 
			
		
		
		
	Improve 'templateSend' method to check the response code to see if it's successful or not.
This commit is contained in:
		| @ -507,7 +507,10 @@ public class WxMpServiceImpl implements WxMpService { | ||||
|     String url = "https://api.weixin.qq.com/cgi-bin/message/template/send"; | ||||
|     String responseContent = execute(new SimplePostRequestExecutor(), url, templateMessage.toJson()); | ||||
|     JsonElement tmpJsonElement = Streams.parse(new JsonReader(new StringReader(responseContent))); | ||||
|     return tmpJsonElement.getAsJsonObject().get("msgid").getAsString(); | ||||
|     final JsonObject jsonObject = tmpJsonElement.getAsJsonObject(); | ||||
|     if (jsonObject.get("errcode").getAsInt() == 0) | ||||
|       return jsonObject.get("msgid").getAsString(); | ||||
|     throw new WxErrorException(WxError.fromJson(responseContent)); | ||||
|   } | ||||
|  | ||||
|   public WxMpSemanticQueryResult semanticQuery(WxMpSemanticQuery semanticQuery) throws WxErrorException { | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Kane Zhu
					Kane Zhu