增加用户资料修改
This commit is contained in:
@@ -26,6 +26,16 @@ func (r *UserRepository) FindByID(id uint64) (*model.User, error) {
|
||||
return &user, nil
|
||||
}
|
||||
|
||||
func (r *UserRepository) UpdateProfile(id uint64, nickname string, avatarURL string) (*model.User, error) {
|
||||
if err := r.db.Model(&model.User{}).Where("id = ?", id).Updates(map[string]any{
|
||||
"nickname": nickname,
|
||||
"avatar_url": avatarURL,
|
||||
}).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return r.FindByID(id)
|
||||
}
|
||||
|
||||
func (r *UserRepository) FindOrCreateByPhone(phone string) (*model.User, error) {
|
||||
now := time.Now()
|
||||
user := model.User{
|
||||
|
||||
Reference in New Issue
Block a user