mirror of
				https://gitee.com/binary/weixin-java-tools.git
				synced 2025-10-31 10:38:42 +08:00 
			
		
		
		
	Merge branch 'develop'
Conflicts: README.md
This commit is contained in:
		| @ -17,7 +17,7 @@ weixin-java-tools | |||||||
| <dependency> | <dependency> | ||||||
|   <groupId>me.chanjar</groupId> |   <groupId>me.chanjar</groupId> | ||||||
|   <artifactId>weixin-java-mp</artifactId> |   <artifactId>weixin-java-mp</artifactId> | ||||||
|   <version>1.1.7</version> |   <version>1.1.8</version> | ||||||
| </dependency> | </dependency> | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
| @ -27,7 +27,7 @@ weixin-java-tools | |||||||
| <dependency> | <dependency> | ||||||
|   <groupId>me.chanjar</groupId> |   <groupId>me.chanjar</groupId> | ||||||
|   <artifactId>weixin-java-cp</artifactId> |   <artifactId>weixin-java-cp</artifactId> | ||||||
|   <version>1.1.7</version> |   <version>1.1.8</version> | ||||||
| </dependency> | </dependency> | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
|  | |||||||
							
								
								
									
										12
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								pom.xml
									
									
									
									
									
								
							| @ -5,7 +5,7 @@ | |||||||
|   <modelVersion>4.0.0</modelVersion> |   <modelVersion>4.0.0</modelVersion> | ||||||
|   <groupId>me.chanjar</groupId> |   <groupId>me.chanjar</groupId> | ||||||
|   <artifactId>weixin-java-parent</artifactId> |   <artifactId>weixin-java-parent</artifactId> | ||||||
|   <version>1.1.7</version> |   <version>1.1.8</version> | ||||||
|   <packaging>pom</packaging> |   <packaging>pom</packaging> | ||||||
|   <name>WeiXin Java Tools - Parent</name> |   <name>WeiXin Java Tools - Parent</name> | ||||||
|   <description>微信公众号、企业号上级POM</description> |   <description>微信公众号、企业号上级POM</description> | ||||||
| @ -225,6 +225,16 @@ | |||||||
|           <goals>deploy</goals> |           <goals>deploy</goals> | ||||||
|         </configuration> |         </configuration> | ||||||
|       </plugin> |       </plugin> | ||||||
|  |       <plugin> | ||||||
|  |         <groupId>org.apache.maven.plugins</groupId> | ||||||
|  |         <artifactId>maven-compiler-plugin</artifactId> | ||||||
|  |         <version>2.3.2</version> | ||||||
|  |         <configuration> | ||||||
|  |           <source>1.7</source> | ||||||
|  |           <target>1.7</target> | ||||||
|  |           <encoding>UTF-8</encoding> | ||||||
|  |         </configuration> | ||||||
|  |       </plugin> | ||||||
|     </plugins> |     </plugins> | ||||||
|   </build> |   </build> | ||||||
|  |  | ||||||
|  | |||||||
| @ -6,7 +6,7 @@ | |||||||
|   <parent> |   <parent> | ||||||
|     <groupId>me.chanjar</groupId> |     <groupId>me.chanjar</groupId> | ||||||
|     <artifactId>weixin-java-parent</artifactId> |     <artifactId>weixin-java-parent</artifactId> | ||||||
|     <version>1.1.7</version> |     <version>1.1.8</version> | ||||||
|   </parent> |   </parent> | ||||||
|  |  | ||||||
|   <artifactId>weixin-java-common</artifactId> |   <artifactId>weixin-java-common</artifactId> | ||||||
|  | |||||||
| @ -53,7 +53,7 @@ public class MediaDownloadRequestExecutor implements RequestExecutor<File, Strin | |||||||
|       httpGet.setConfig(config); |       httpGet.setConfig(config); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     CloseableHttpResponse response = httpclient.execute(httpGet); |     try (CloseableHttpResponse response = httpclient.execute(httpGet)) { | ||||||
|  |  | ||||||
|       Header[] contentTypeHeader = response.getHeaders("Content-Type"); |       Header[] contentTypeHeader = response.getHeaders("Content-Type"); | ||||||
|       if (contentTypeHeader != null && contentTypeHeader.length > 0) { |       if (contentTypeHeader != null && contentTypeHeader.length > 0) { | ||||||
| @ -73,6 +73,9 @@ public class MediaDownloadRequestExecutor implements RequestExecutor<File, Strin | |||||||
|       String[] name_ext = fileName.split("\\."); |       String[] name_ext = fileName.split("\\."); | ||||||
|       File localFile = FileUtils.createTmpFile(inputStream, name_ext[0], name_ext[1], tmpDirFile); |       File localFile = FileUtils.createTmpFile(inputStream, name_ext[0], name_ext[1], tmpDirFile); | ||||||
|       return localFile; |       return localFile; | ||||||
|  |  | ||||||
|  |     } | ||||||
|  |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   protected String getFileName(CloseableHttpResponse response) { |   protected String getFileName(CloseableHttpResponse response) { | ||||||
|  | |||||||
| @ -39,7 +39,7 @@ public class MediaUploadRequestExecutor implements RequestExecutor<WxMediaUpload | |||||||
|       httpPost.setEntity(entity); |       httpPost.setEntity(entity); | ||||||
|       httpPost.setHeader("Content-Type", ContentType.MULTIPART_FORM_DATA.toString()); |       httpPost.setHeader("Content-Type", ContentType.MULTIPART_FORM_DATA.toString()); | ||||||
|     } |     } | ||||||
|     CloseableHttpResponse response = httpclient.execute(httpPost); |     try (CloseableHttpResponse response = httpclient.execute(httpPost)) { | ||||||
|       String responseContent = Utf8ResponseHandler.INSTANCE.handleResponse(response); |       String responseContent = Utf8ResponseHandler.INSTANCE.handleResponse(response); | ||||||
|       WxError error = WxError.fromJson(responseContent); |       WxError error = WxError.fromJson(responseContent); | ||||||
|       if (error.getErrorCode() != 0) { |       if (error.getErrorCode() != 0) { | ||||||
| @ -47,5 +47,6 @@ public class MediaUploadRequestExecutor implements RequestExecutor<WxMediaUpload | |||||||
|       } |       } | ||||||
|       return WxMediaUploadResult.fromJson(responseContent); |       return WxMediaUploadResult.fromJson(responseContent); | ||||||
|     } |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -33,7 +33,7 @@ public class SimpleGetRequestExecutor implements RequestExecutor<String, String> | |||||||
|       httpGet.setConfig(config); |       httpGet.setConfig(config); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     CloseableHttpResponse response = httpclient.execute(httpGet); |     try (CloseableHttpResponse response = httpclient.execute(httpGet)) { | ||||||
|       String responseContent = Utf8ResponseHandler.INSTANCE.handleResponse(response); |       String responseContent = Utf8ResponseHandler.INSTANCE.handleResponse(response); | ||||||
|       WxError error = WxError.fromJson(responseContent); |       WxError error = WxError.fromJson(responseContent); | ||||||
|       if (error.getErrorCode() != 0) { |       if (error.getErrorCode() != 0) { | ||||||
| @ -41,5 +41,6 @@ public class SimpleGetRequestExecutor implements RequestExecutor<String, String> | |||||||
|       } |       } | ||||||
|       return responseContent; |       return responseContent; | ||||||
|     } |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -40,7 +40,7 @@ public class SimplePostRequestExecutor implements RequestExecutor<String, String | |||||||
|       httpPost.setEntity(entity); |       httpPost.setEntity(entity); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     CloseableHttpResponse response = httpclient.execute(httpPost); |     try (CloseableHttpResponse response = httpclient.execute(httpPost)) { | ||||||
|       String responseContent = Utf8ResponseHandler.INSTANCE.handleResponse(response); |       String responseContent = Utf8ResponseHandler.INSTANCE.handleResponse(response); | ||||||
|       WxError error = WxError.fromJson(responseContent); |       WxError error = WxError.fromJson(responseContent); | ||||||
|       if (error.getErrorCode() != 0) { |       if (error.getErrorCode() != 0) { | ||||||
| @ -48,5 +48,6 @@ public class SimplePostRequestExecutor implements RequestExecutor<String, String | |||||||
|       } |       } | ||||||
|       return responseContent; |       return responseContent; | ||||||
|     } |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -6,7 +6,7 @@ | |||||||
|     <parent> |     <parent> | ||||||
|         <groupId>me.chanjar</groupId> |         <groupId>me.chanjar</groupId> | ||||||
|         <artifactId>weixin-java-parent</artifactId> |         <artifactId>weixin-java-parent</artifactId> | ||||||
|         <version>1.1.7</version> |         <version>1.1.8</version> | ||||||
|     </parent> |     </parent> | ||||||
|  |  | ||||||
|     <artifactId>weixin-java-cp</artifactId> |     <artifactId>weixin-java-cp</artifactId> | ||||||
|  | |||||||
| @ -117,8 +117,10 @@ public class WxCpServiceImpl implements WxCpService { | |||||||
|               httpGet.setConfig(config); |               httpGet.setConfig(config); | ||||||
|             } |             } | ||||||
|             CloseableHttpClient httpclient = getHttpclient(); |             CloseableHttpClient httpclient = getHttpclient(); | ||||||
|             CloseableHttpResponse response = httpclient.execute(httpGet); |             String resultContent = null; | ||||||
|             String resultContent = new BasicResponseHandler().handleResponse(response); |             try (CloseableHttpResponse response = httpclient.execute(httpGet)) { | ||||||
|  |               resultContent = new BasicResponseHandler().handleResponse(response); | ||||||
|  |             } | ||||||
|             WxError error = WxError.fromJson(resultContent); |             WxError error = WxError.fromJson(resultContent); | ||||||
|             if (error.getErrorCode() != 0) { |             if (error.getErrorCode() != 0) { | ||||||
|               throw new WxErrorException(error); |               throw new WxErrorException(error); | ||||||
|  | |||||||
| @ -6,7 +6,7 @@ | |||||||
|     <parent> |     <parent> | ||||||
|         <groupId>me.chanjar</groupId> |         <groupId>me.chanjar</groupId> | ||||||
|         <artifactId>weixin-java-parent</artifactId> |         <artifactId>weixin-java-parent</artifactId> | ||||||
|         <version>1.1.7</version> |         <version>1.1.8</version> | ||||||
|     </parent> |     </parent> | ||||||
|     <artifactId>weixin-java-mp</artifactId> |     <artifactId>weixin-java-mp</artifactId> | ||||||
|     <name>WeiXin Java Tools - MP</name> |     <name>WeiXin Java Tools - MP</name> | ||||||
|  | |||||||
| @ -47,8 +47,7 @@ public class QrCodeRequestExecutor implements RequestExecutor<File, WxMpQrCodeTi | |||||||
|       httpGet.setConfig(config); |       httpGet.setConfig(config); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     CloseableHttpResponse response = httpclient.execute(httpGet); |     try (CloseableHttpResponse response = httpclient.execute(httpGet)) { | ||||||
|  |  | ||||||
|       Header[] contentTypeHeader = response.getHeaders("Content-Type"); |       Header[] contentTypeHeader = response.getHeaders("Content-Type"); | ||||||
|       if (contentTypeHeader != null && contentTypeHeader.length > 0) { |       if (contentTypeHeader != null && contentTypeHeader.length > 0) { | ||||||
|         // 出错 |         // 出错 | ||||||
| @ -64,3 +63,5 @@ public class QrCodeRequestExecutor implements RequestExecutor<File, WxMpQrCodeTi | |||||||
|     } |     } | ||||||
|  |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | } | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Daniel Qian
					Daniel Qian