feat(login): 添加Bcrypt密码哈希功能并集成用户认证

- 引入golang.org/x/crypto/bcrypt包用于密码哈希处理
- 实现HashPassword函数对密码进行Bcrypt哈希
- 实现CheckPasswordHash函数验证密码与哈希匹配
- 添加示例代码演示密码哈希和验证功能

feat(login): 集成外部用户信息服务

- 实现GetUserInfo方法调用外部服务获取用户信息
- 添加用户信息展示的示例代码
- 集成用户登录验证流程

fix
This commit is contained in:
2025-12-31 16:20:01 +08:00
parent 689367ba7d
commit ba60b03bbf
5 changed files with 287 additions and 6 deletions

View File

@@ -12,7 +12,7 @@ type BaseSysUser struct {
DepartmentID uint `gorm:"column:departmentId;type:bigint;index" json:"departmentId"` // 部门ID
Username string `gorm:"column:username;type:varchar(100);not null;Index" json:"username"` // 用户名
Password string `gorm:"column:password;type:varchar(255);not null" json:"password"` // 密码
Password string `gorm:"column:password;type:varchar(255);" json:"password"` // 密码
PasswordV *int32 `gorm:"column:passwordV;type:int;not null;default:1" json:"passwordV"` // 密码版本, 作用是改完密码让原来的token失效
HeadImg *string `gorm:"column:headImg;type:varchar(255)" json:"headImg"` // 头像