mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-11 06:57:12 +08:00
新增:新增获取用户信息 API,未设置头像时,前端将根据用户性别显示对应默认头像
This commit is contained in:
@@ -29,17 +29,21 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
|
||||
import top.charles7c.cnadmin.auth.config.properties.CaptchaProperties;
|
||||
import top.charles7c.cnadmin.auth.model.request.LoginRequest;
|
||||
import top.charles7c.cnadmin.auth.model.vo.LoginVO;
|
||||
import top.charles7c.cnadmin.auth.model.vo.UserInfoVO;
|
||||
import top.charles7c.cnadmin.auth.service.LoginService;
|
||||
import top.charles7c.cnadmin.common.config.properties.RsaProperties;
|
||||
import top.charles7c.cnadmin.common.model.dto.LoginUser;
|
||||
import top.charles7c.cnadmin.common.model.vo.R;
|
||||
import top.charles7c.cnadmin.common.util.CheckUtils;
|
||||
import top.charles7c.cnadmin.common.util.ExceptionUtils;
|
||||
import top.charles7c.cnadmin.common.util.RedisUtils;
|
||||
import top.charles7c.cnadmin.common.util.SecureUtils;
|
||||
import top.charles7c.cnadmin.common.util.helper.LoginHelper;
|
||||
|
||||
/**
|
||||
* 登录 API
|
||||
@@ -85,4 +89,12 @@ public class LoginController {
|
||||
StpUtil.logout();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Operation(summary = "获取用户信息", description = "获取登录用户信息")
|
||||
@GetMapping("/user/info")
|
||||
public R<UserInfoVO> getUserInfo() {
|
||||
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||
UserInfoVO userInfoVo = BeanUtil.copyProperties(loginUser, UserInfoVO.class);
|
||||
return R.ok(userInfoVo);
|
||||
}
|
||||
}
|
@@ -2,5 +2,5 @@
|
||||
|
||||
-- changeset Charles7c:1
|
||||
-- 初始化默认用户:admin/123456;test/123456
|
||||
INSERT IGNORE INTO `sys_user` VALUES (1, 'admin', '超级管理员', 'f0df7414507bcb57e07e18555821228a', 1, NULL, 'charles7c@126.com', NULL, NULL, 1, NULL, 1, NOW(), 1, NOW());
|
||||
INSERT IGNORE INTO `sys_user` VALUES (2, 'test', '测试员', '8e114197e1b33783a00542ad67e80516', 0, NULL, NULL, NULL, NULL, 2, NULL, 1, NOW(), 1, NOW());
|
||||
INSERT IGNORE INTO `sys_user` VALUES (1, 'admin', '超级管理员', 'f0df7414507bcb57e07e18555821228a', 1, '18888888888', 'charles7c@126.com', NULL, NULL, 1, NOW(), 1, NOW(), 1, NOW());
|
||||
INSERT IGNORE INTO `sys_user` VALUES (2, 'test', '测试员', '8e114197e1b33783a00542ad67e80516', 0, NULL, NULL, NULL, NULL, 2, NOW(), 1, NOW(), 1, NOW());
|
||||
|
@@ -24,7 +24,6 @@ CREATE TABLE IF NOT EXISTS `sys_user` (
|
||||
INDEX `idx_updateUser`(`update_user`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户表';
|
||||
|
||||
-- changeset Charles7c:2
|
||||
CREATE TABLE IF NOT EXISTS `sys_log` (
|
||||
`log_id` bigint(20) unsigned AUTO_INCREMENT COMMENT '日志ID',
|
||||
`log_level` varchar(255) DEFAULT NULL COMMENT '日志级别',
|
||||
|
Reference in New Issue
Block a user