|
@@ -4,6 +4,7 @@ package com.hfln.portal.infrastructure.gateway.impl;
|
|
import cn.dev33.satoken.session.SaSession;
|
|
import cn.dev33.satoken.session.SaSession;
|
|
import cn.dev33.satoken.stp.SaTokenInfo;
|
|
import cn.dev33.satoken.stp.SaTokenInfo;
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
|
|
+import cn.dev33.satoken.stp.parameter.SaLoginParameter;
|
|
import cn.hfln.framework.extension.BizException;
|
|
import cn.hfln.framework.extension.BizException;
|
|
import cn.hfln.framework.redis.util.RedisUtil;
|
|
import cn.hfln.framework.redis.util.RedisUtil;
|
|
import com.alibaba.fastjson2.JSON;
|
|
import com.alibaba.fastjson2.JSON;
|
|
@@ -105,7 +106,11 @@ public class UserGatewayImpl implements UserGateway {
|
|
@Autowired
|
|
@Autowired
|
|
private OssFileService ossFileService;
|
|
private OssFileService ossFileService;
|
|
|
|
|
|
-// public static String WXX_CX_ACCESS_TOKEN = "";
|
|
|
|
|
|
+ @Value("${sa-token.wx.timeout}")
|
|
|
|
+ private long wxTimeout;
|
|
|
|
+
|
|
|
|
+ @Value("${sa-token.wx.active-timeout}")
|
|
|
|
+ private long wxActiveTimeout;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private WxOfficeAccountClient wxOfficeAccountClient;
|
|
private WxOfficeAccountClient wxOfficeAccountClient;
|
|
@@ -193,7 +198,11 @@ public class UserGatewayImpl implements UserGateway {
|
|
// 先清除之前登录信息
|
|
// 先清除之前登录信息
|
|
StpUtil.logout(RedisCacheConstant.WX_USER_PRE + userInfo.getUserId(), DeviceType.WX.getCode());
|
|
StpUtil.logout(RedisCacheConstant.WX_USER_PRE + userInfo.getUserId(), DeviceType.WX.getCode());
|
|
|
|
|
|
- StpUtil.login(RedisCacheConstant.WX_USER_PRE + userInfo.getUserId(), DeviceType.WX.getCode());
|
|
|
|
|
|
+ StpUtil.login(RedisCacheConstant.WX_USER_PRE + userInfo.getUserId(),
|
|
|
|
+ SaLoginParameter.create()
|
|
|
|
+ .setDeviceType(DeviceType.WX.getCode())
|
|
|
|
+ .setTimeout(wxTimeout)
|
|
|
|
+ .setActiveTimeout(wxActiveTimeout));
|
|
// 这里可以考虑 在session 中插入信息
|
|
// 这里可以考虑 在session 中插入信息
|
|
// 同账户多设备 登录共享信息
|
|
// 同账户多设备 登录共享信息
|
|
// 当前 token session 独享信息
|
|
// 当前 token session 独享信息
|
|
@@ -290,7 +299,11 @@ public class UserGatewayImpl implements UserGateway {
|
|
redisService.del(redisKey);
|
|
redisService.del(redisKey);
|
|
|
|
|
|
// 登录
|
|
// 登录
|
|
- StpUtil.login(RedisCacheConstant.WX_USER_PRE + user.getUserId(), DeviceType.WX.getCode());
|
|
|
|
|
|
+ StpUtil.login(RedisCacheConstant.WX_USER_PRE + user.getUserId(),
|
|
|
|
+ SaLoginParameter.create()
|
|
|
|
+ .setDeviceType(DeviceType.WX.getCode())
|
|
|
|
+ .setTimeout(wxTimeout)
|
|
|
|
+ .setActiveTimeout(wxActiveTimeout));
|
|
SaTokenInfo tokenInfo = StpUtil.getTokenInfo();
|
|
SaTokenInfo tokenInfo = StpUtil.getTokenInfo();
|
|
|
|
|
|
// 构造返回对象
|
|
// 构造返回对象
|
|
@@ -571,7 +584,11 @@ public class UserGatewayImpl implements UserGateway {
|
|
}
|
|
}
|
|
|
|
|
|
if (!StpUtil.isLogin()) {
|
|
if (!StpUtil.isLogin()) {
|
|
- StpUtil.login(RedisCacheConstant.WX_USER_PRE + userInfo.getUserId(), DeviceType.WX.getCode());
|
|
|
|
|
|
+ StpUtil.login(RedisCacheConstant.WX_USER_PRE + userInfo.getUserId(),
|
|
|
|
+ SaLoginParameter.create()
|
|
|
|
+ .setDeviceType(DeviceType.WX.getCode())
|
|
|
|
+ .setTimeout(wxTimeout)
|
|
|
|
+ .setActiveTimeout(wxActiveTimeout));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|