|
|
|
@ -60,9 +60,9 @@ public class WeChatUtil { |
|
|
|
|
// String appid = PropUtils.getProp("APPID");
|
|
|
|
|
// String appsecret = PropUtils.getProp("APPSECRET");
|
|
|
|
|
// 微信小程序ID
|
|
|
|
|
String appid = WeChatPropertiesUtil.PARTNER_WX_OPEN_APP_ID; |
|
|
|
|
String appid = WeChatPropertiesUtil.KINDERGARTEN_WX_OPEN_APP_ID; |
|
|
|
|
// 微信小程序秘钥
|
|
|
|
|
String appsecret =WeChatPropertiesUtil.PARTNER_WX_OPEN_APP_SECRET; |
|
|
|
|
String appsecret =WeChatPropertiesUtil.KINDERGARTEN_WX_OPEN_APP_SECRET; |
|
|
|
|
|
|
|
|
|
//构建url,用于向微信服务器请求用户的openId
|
|
|
|
|
StringBuffer url = new StringBuffer("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&"); |
|
|
|
@ -75,7 +75,7 @@ public class WeChatUtil { |
|
|
|
|
HttpResponse httpResponse = client.execute(httpGet); |
|
|
|
|
HttpEntity result = httpResponse.getEntity(); |
|
|
|
|
String resultStr = EntityUtils.toString(result); |
|
|
|
|
System.out.println(resultStr); |
|
|
|
|
System.err.println(resultStr); |
|
|
|
|
JSONObject resultJsonObject = JSONUtil.parseObj(resultStr); |
|
|
|
|
String accessToken = (String) resultJsonObject.get("access_token"); |
|
|
|
|
return accessToken; |
|
|
|
|