This commit is contained in:
张超
2025-05-27 19:01:05 +08:00
parent f02495cc7a
commit 5ffc64e1dd
16 changed files with 512 additions and 123 deletions

View File

@@ -7,3 +7,12 @@ type User struct {
Password string
PasswordHash []byte
}
// GetUserByID 根据 ID 查询用户
func GetUserByID(id uint) (*User, error) {
var user User
if err := DB.First(&user, id).Error; err != nil {
return nil, err
}
return &user, nil
}