From 8b068b0f1a37db8e4253315af9c1885eacc0ad56 Mon Sep 17 00:00:00 2001 From: huangdeliang <huangdeliang@skieer.com> Date: Thu, 13 May 2021 20:27:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E6=8E=A5=E5=8F=A3=E5=BC=80?= =?UTF-8?q?=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/WeChartAppletServiceImp.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/WeChartAppletServiceImp.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/WeChartAppletServiceImp.java index 8e425e5c8..21199866f 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/WeChartAppletServiceImp.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/WeChartAppletServiceImp.java @@ -38,15 +38,12 @@ public class WeChartAppletServiceImp implements IWechatAppletService { ResponseEntity<String> entity = restTemplate.getForEntity(url, String.class, param); - return entity.getBody(); -// JSONObject resultObj = JSONObject.parseObject(entity.getBody()); -// -// if (resultObj.getInteger("errcode") == 0) { -// accessToken = resultObj.getString("access_token"); -// Integer expiresIn = resultObj.getInteger("expires_in"); -// redisCache.setCacheObject(appId, accessToken, expiresIn, TimeUnit.SECONDS); -// } + JSONObject resultObj = JSONObject.parseObject(entity.getBody()); + + accessToken = resultObj.getString("access_token"); + Integer expiresIn = resultObj.getInteger("expires_in"); + redisCache.setCacheObject(appId, accessToken, expiresIn, TimeUnit.SECONDS); } return accessToken; }