Commit 96ab3341 authored by 李德才's avatar 李德才

防止redis 关闭导致的无法登录

parent a68ed777
...@@ -249,15 +249,20 @@ public class IndexController extends Controller { ...@@ -249,15 +249,20 @@ public class IndexController extends Controller {
Map<String, Object> columns = Db.findById("AS_USER", "USERNAME", username).getColumns(); Map<String, Object> columns = Db.findById("AS_USER", "USERNAME", username).getColumns();
Map<Object, Object> userInfo = new HashMap<>(); Map<Object, Object> userInfo = new HashMap<>();
userInfo.putAll(columns); userInfo.putAll(columns);
Redis.use().hmset(username + "_INFO", userInfo); try {
// 设置过期时间 Redis.use().hmset(username + "_INFO", userInfo);
Redis.use().expire(username, 60 * 60 * 24); // 设置过期时间
Redis.use().expire(username, 60 * 60 * 24);
}catch (Exception e) {
e.printStackTrace();
}finally {
this.renderJson(Ret.ok("token", jws).set("callback", callback));
logService.saveAsLog("login", username, JwtInterceptor.getIpAddr(getRequest()),
username + "登录" + app + "成功", app);
}
/** /**
* 20200706 lidecai 将用户信息保存到Redis end * 20200706 lidecai 将用户信息保存到Redis end
*/ */
this.renderJson(Ret.ok("token", jws).set("callback", callback));
logService.saveAsLog("login", username, JwtInterceptor.getIpAddr(getRequest()),
username + "登录" + app + "成功", app);
} catch (Exception e) { } catch (Exception e) {
log.error("生成登录票据失败", e); log.error("生成登录票据失败", e);
this.renderJson(Ret.fail("msg", "生成登录票据失败")); this.renderJson(Ret.fail("msg", "生成登录票据失败"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment