From 8d2486aa78428c7246b462bd6d5553940f2b864a Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 22 Jul 2020 18:10:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E7=99=BB=E9=99=86?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E4=B8=A4=E4=B8=AA=E5=BF=85=E8=A6=81token?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/wxapi/service/impl/WxLoginServiceImpl.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxLoginServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxLoginServiceImpl.java index 8ae28634de..87f7563298 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxLoginServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxLoginServiceImpl.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.HttpClientManager; +import com.epmet.constant.ThirdRedisKeyConstant; import com.epmet.dto.UserWechatDTO; import com.epmet.wxapi.constant.WxLoginConstant; import com.epmet.wxapi.service.WxLoginService; @@ -45,7 +46,7 @@ public class WxLoginServiceImpl implements WxLoginService { map.put("js_code", wxCode); map.put("grant_type", "authorization_code"); map.put("component_appid", componentAppId); - String componentAccessToken = (String) redisUtils.get("epmet:wechartthird:componentaccesstoken"); + String componentAccessToken = (String) redisUtils.get(ThirdRedisKeyConstant.ACCESS_TOKEN_REDIS_KEY); map.put("component_access_token", componentAccessToken); String resultStr = HttpClientManager.getInstance().sendGet(WxLoginConstant.WXCODE_BY_OPENID, map).getData(); HashMap hashMap = JSON.parseObject(resultStr, HashMap.class); @@ -58,9 +59,9 @@ public class WxLoginServiceImpl implements WxLoginService { //2.换取用户基本信息 //小程序access_token - String access_token = (String) redisUtils.get("epmet:wechartthird:authinfo" + ":" + customerId + ":" + clientType); + Map accessMap = redisUtils.hGetAll(ThirdRedisKeyConstant.AUTH_INFO_REDIS_KEY + ":" + customerId + ":" + clientType); Map hash = new HashMap<>(); - hash.put("access_token", access_token); + hash.put("access_token", accessMap.get("authorizer_access_token")); hash.put("openid", openid); hash.put("lang", "zh_CN"); String getStr = HttpClientManager.getInstance().sendGet(WxLoginConstant.OPENID_TO_INFORMATION, map).getData();