88
99## 项目状态
1010
11- 当前版本` 0.4.0 ` 为测试版本。请商户的专业技术人员在使用时注意系统和软件的正确性和兼容性,以及带来的风险。
11+ 当前版本` 0.4.1 ` 为测试版本。请商户的专业技术人员在使用时注意系统和软件的正确性和兼容性,以及带来的风险。
1212
1313## 升级指引
1414
2727在你的` build.gradle ` 文件中加入如下的依赖
2828
2929``` groovy
30- implementation 'com.github.wechatpay-apiv3:wechatpay-apache-httpclient:0.4.0 '
30+ implementation 'com.github.wechatpay-apiv3:wechatpay-apache-httpclient:0.4.1 '
3131```
3232
3333### Maven
@@ -37,7 +37,7 @@ implementation 'com.github.wechatpay-apiv3:wechatpay-apache-httpclient:0.4.0'
3737<dependency >
3838 <groupId >com.github.wechatpay-apiv3</groupId >
3939 <artifactId >wechatpay-apache-httpclient</artifactId >
40- <version >0.4.0 </version >
40+ <version >0.4.1 </version >
4141</dependency >
4242```
4343
@@ -246,7 +246,7 @@ try {
246246
247247我们对上传的参数组装和签名逻辑进行了一定的封装,只需要以下几步:
248248
249- 1 . 使用` WechatPayUploadHttpPost ` 构造一个上传的` HttpPost ` ,需设置待上传文件的文件名,SHA256摘要,文件的输入流。
249+ 1 . 使用` WechatPayUploadHttpPost ` 构造一个上传的` HttpPost ` ,需设置待上传文件的文件名,SHA256摘要,文件的输入流。在 ` 0.4.1 ` 及以上版本,支持设置媒体文件元信息。
2502502 . 通过` WechatPayHttpClientBuilder ` 得到的` HttpClient ` 发送请求。
251251
252252示例请参考下列代码。
@@ -260,6 +260,7 @@ try (FileInputStream ins1 = new FileInputStream(file)) {
260260 String sha256 = DigestUtils . sha256Hex(ins1);
261261 try (InputStream ins2 = new FileInputStream (file)) {
262262 HttpPost request = new WechatPayUploadHttpPost .Builder (uri)
263+ // 如需直接设置媒体文件元信息,可使用withFile代替withImage
263264 .withImage(file. getName(), sha256, ins2)
264265 .build();
265266 CloseableHttpResponse response1 = httpClient. execute(request);
0 commit comments