mirror of
				https://gitee.com/binary/weixin-java-tools.git
				synced 2025-10-31 02:28:25 +08:00 
			
		
		
		
	Merge pull request #216 from videome/develop
Improve 'templateSend' method to check the response code to see if it…
This commit is contained in:
		| @ -504,7 +504,10 @@ public class WxMpServiceImpl implements WxMpService { | |||||||
|     String url = "https://api.weixin.qq.com/cgi-bin/message/template/send"; |     String url = "https://api.weixin.qq.com/cgi-bin/message/template/send"; | ||||||
|     String responseContent = execute(new SimplePostRequestExecutor(), url, templateMessage.toJson()); |     String responseContent = execute(new SimplePostRequestExecutor(), url, templateMessage.toJson()); | ||||||
|     JsonElement tmpJsonElement = Streams.parse(new JsonReader(new StringReader(responseContent))); |     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 { |   public WxMpSemanticQueryResult semanticQuery(WxMpSemanticQuery semanticQuery) throws WxErrorException { | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Daniel Qian
					Daniel Qian