首页 > 其他 > 详细

关于小程序支付功能的爬坑

时间:2017-09-21 20:25:06      阅读:275      评论:0      收藏:0      [点我收藏+]

代码大部分用的http://www.wxapp-union.com/article-2516-1.html提供的。

但是,此代码在使用org.apache.httpcomponents(4.3.5)里的HttpPost实例化时出错。

解决:maven中引入的httpclient和httpcore版本一致,如

<dependency>
     <groupId>org.apache.httpcomponents</groupId>
     <artifactId>httpclient</artifactId>
     <version>4.4</version>
</dependency>
<dependency>
     <groupId>org.apache.httpcomponents</groupId>
     <artifactId>httpcore</artifactId>
     <version>4.4</version>
</dependency>

还有,订单order中的body不能为中文,wtf

解决:将MD5Encode方法中的resultString = byteArrayToHexString(md.digest(resultString.getBytes()))改为

resultString = byteArrayToHexString(md.digest(resultString.getBytes("utf-8")))

关于小程序支付功能的爬坑

原文:http://www.cnblogs.com/daidao/p/7570154.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!