|
@@ -44,11 +44,12 @@ public class AppletTokenRefreshServiceImpl implements IAppletTokenRefreshService
|
|
|
param.put("appid", appId);
|
|
param.put("appid", appId);
|
|
|
param.put("secret", applet.getString("appSecret"));
|
|
param.put("secret", applet.getString("appSecret"));
|
|
|
param.put("grant_type", "client_credential");
|
|
param.put("grant_type", "client_credential");
|
|
|
- String result = HttpUtils.httpGet("https://api.weixin.qq.com/cgi-bin/token", param, null);
|
|
|
|
|
|
|
+// String result = HttpUtils.httpGet("https://api.weixin.qq.com/cgi-bin/token", param, null);
|
|
|
|
|
+ String result = HttpUtils.httpPostRequest("https://api.weixin.qq.com/cgi-bin/stable_token", param, null);
|
|
|
JSONObject tokenInfo = JSONObject.parseObject(result);
|
|
JSONObject tokenInfo = JSONObject.parseObject(result);
|
|
|
if (!Check.isNull(tokenInfo)) {
|
|
if (!Check.isNull(tokenInfo)) {
|
|
|
String accessToken = tokenInfo.getString("access_token");
|
|
String accessToken = tokenInfo.getString("access_token");
|
|
|
- redis2Template_db5.opsForValue().set("wechat-applet-access-token-key-" + applet.getInteger("id"), accessToken, 60, TimeUnit.MINUTES);
|
|
|
|
|
|
|
+ redis2Template_db5.opsForValue().set("wechat-applet-access-token-key-" + applet.getInteger("id"), accessToken, tokenInfo.getInteger("expires_in"), TimeUnit.SECONDS);
|
|
|
applet.put("token", accessToken);
|
|
applet.put("token", accessToken);
|
|
|
log.info("小程序:{},更新token完成", name);
|
|
log.info("小程序:{},更新token完成", name);
|
|
|
} else {
|
|
} else {
|