update
This commit is contained in:
@@ -69,3 +69,12 @@ func (a *Account) CheckDuplicateUsername() bool {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
// GetAccountByID 根据 ID 查询用户
|
||||
func GetAccountByID(id uint) (*Account, error) {
|
||||
var account Account
|
||||
if err := DB.First(&account, id).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &account, nil
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user