fix: 某种不知名的情况下,微信联合登陆会报错问题处理
This commit is contained in:
parent
56b800e4ff
commit
105162aa89
@ -5,7 +5,6 @@ import cn.hutool.core.util.StrUtil;
|
|||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import cn.lili.cache.Cache;
|
import cn.lili.cache.Cache;
|
||||||
import cn.lili.cache.CachePrefix;
|
|
||||||
import cn.lili.common.enums.ClientTypeEnum;
|
import cn.lili.common.enums.ClientTypeEnum;
|
||||||
import cn.lili.common.enums.ResultCode;
|
import cn.lili.common.enums.ResultCode;
|
||||||
import cn.lili.common.exception.ServiceException;
|
import cn.lili.common.exception.ServiceException;
|
||||||
@ -125,9 +124,7 @@ public class ConnectServiceImpl extends ServiceImpl<ConnectMapper, Connect> impl
|
|||||||
@Transactional
|
@Transactional
|
||||||
public Token miniProgramAutoLogin(WechatMPLoginParams params) {
|
public Token miniProgramAutoLogin(WechatMPLoginParams params) {
|
||||||
|
|
||||||
Object cacheData = cache.get(CachePrefix.WECHAT_SESSION_PARAMS.getPrefix() + params.getUuid());
|
|
||||||
Map<String, String> map = new HashMap<>(3);
|
Map<String, String> map = new HashMap<>(3);
|
||||||
if (cacheData == null) {
|
|
||||||
//得到微信小程序联合登陆信息
|
//得到微信小程序联合登陆信息
|
||||||
JSONObject json = this.getConnect(params.getCode());
|
JSONObject json = this.getConnect(params.getCode());
|
||||||
//存储session key 后续登录用得到
|
//存储session key 后续登录用得到
|
||||||
@ -137,12 +134,8 @@ public class ConnectServiceImpl extends ServiceImpl<ConnectMapper, Connect> impl
|
|||||||
map.put("sessionKey", sessionKey);
|
map.put("sessionKey", sessionKey);
|
||||||
map.put("unionId", unionId);
|
map.put("unionId", unionId);
|
||||||
map.put("openId", openId);
|
map.put("openId", openId);
|
||||||
cache.put(CachePrefix.WECHAT_SESSION_PARAMS.getPrefix() + params.getUuid(), map, 900L);
|
|
||||||
} else {
|
|
||||||
map = (Map<String, String>) cacheData;
|
|
||||||
}
|
|
||||||
//微信联合登陆参数
|
|
||||||
|
|
||||||
|
//微信联合登陆参数
|
||||||
return phoneMpBindAndLogin(map.get("sessionKey"), params, map.get("openId"), map.get("unionId"));
|
return phoneMpBindAndLogin(map.get("sessionKey"), params, map.get("openId"), map.get("unionId"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user