mirror of https://gitee.com/y_project/RuoYi.git
优化记录登录信息,防止不必要的修改
parent
ff3d2134a5
commit
69d31e301f
|
@ -55,8 +55,8 @@ public class SysIndexController extends BaseController
|
||||||
mmap.put("user", user);
|
mmap.put("user", user);
|
||||||
mmap.put("sideTheme", configService.selectConfigByKey("sys.index.sideTheme"));
|
mmap.put("sideTheme", configService.selectConfigByKey("sys.index.sideTheme"));
|
||||||
mmap.put("skinName", configService.selectConfigByKey("sys.index.skinName"));
|
mmap.put("skinName", configService.selectConfigByKey("sys.index.skinName"));
|
||||||
Boolean footer = Convert.toBool(configService.selectConfigByKey("sys.index.footer"));
|
Boolean footer = Convert.toBool(configService.selectConfigByKey("sys.index.footer"), true);
|
||||||
Boolean tagsView = Convert.toBool(configService.selectConfigByKey("sys.index.tagsView"));
|
Boolean tagsView = Convert.toBool(configService.selectConfigByKey("sys.index.tagsView"), true);
|
||||||
mmap.put("footer", footer);
|
mmap.put("footer", footer);
|
||||||
mmap.put("tagsView", tagsView);
|
mmap.put("tagsView", tagsView);
|
||||||
mmap.put("mainClass", contentMainClass(footer, tagsView));
|
mmap.put("mainClass", contentMainClass(footer, tagsView));
|
||||||
|
|
|
@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.text.Convert;
|
||||||
import com.ruoyi.common.utils.ServletUtils;
|
import com.ruoyi.common.utils.ServletUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.framework.web.service.ConfigService;
|
import com.ruoyi.framework.web.service.ConfigService;
|
||||||
|
@ -47,7 +48,7 @@ public class SysLoginController extends BaseController
|
||||||
// 是否开启记住我
|
// 是否开启记住我
|
||||||
mmap.put("isRemembered", rememberMe);
|
mmap.put("isRemembered", rememberMe);
|
||||||
// 是否开启用户注册
|
// 是否开启用户注册
|
||||||
mmap.put("isAllowRegister", configService.getKey("sys.account.registerUser"));
|
mmap.put("isAllowRegister", Convert.toBool(configService.getKey("sys.account.registerUser"), false));
|
||||||
return "login";
|
return "login";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,7 @@ public class SysLoginService
|
||||||
passwordService.validate(user, password);
|
passwordService.validate(user, password);
|
||||||
|
|
||||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
|
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
|
||||||
recordLoginInfo(user);
|
recordLoginInfo(user.getUserId());
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,9 +130,13 @@ public class SysLoginService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 记录登录信息
|
* 记录登录信息
|
||||||
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
*/
|
*/
|
||||||
public void recordLoginInfo(SysUser user)
|
public void recordLoginInfo(Long userId)
|
||||||
{
|
{
|
||||||
|
SysUser user = new SysUser();
|
||||||
|
user.setUserId(userId);
|
||||||
user.setLoginIp(ShiroUtils.getIp());
|
user.setLoginIp(ShiroUtils.getIp());
|
||||||
user.setLoginDate(DateUtils.getNowDate());
|
user.setLoginDate(DateUtils.getNowDate());
|
||||||
userService.updateUserInfo(user);
|
userService.updateUserInfo(user);
|
||||||
|
|
Loading…
Reference in New Issue