|
|
@ -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<String, String> 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<String, Object> accessMap = redisUtils.hGetAll(ThirdRedisKeyConstant.AUTH_INFO_REDIS_KEY + ":" + customerId + ":" + clientType); |
|
|
|
Map<String, Object> 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(); |
|
|
|