Skip to content

Commit

Permalink
fix(queries.Register): handle error from updating inviter's reward
Browse files Browse the repository at this point in the history
  • Loading branch information
AstatineAi committed May 23, 2024
1 parent bccfdda commit 570468a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/queries/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,10 @@ func Register(db *gorm.DB, u *models.User, invitation_code string) error {
u.InvitedByUserID = inviter.ID
// TODO: only once for the inviter?
inviter.Reward += 100
db.Select("reward").Save(inviter)
err = db.Select("reward").Save(inviter).Error
if err != nil {
return errors.Wrap(err, errors.DatabaseError)
}
}

// 检查邮箱是否已存在
Expand Down

0 comments on commit 570468a

Please sign in to comment.