feat: No operation is allowed when the reputation requirement is less than 0

This commit is contained in:
LinkinStar 2022-11-25 12:22:53 +08:00
parent ee7428cba5
commit 645df9d20f
1 changed files with 2 additions and 3 deletions

View File

@ -162,10 +162,9 @@ func (rs *RankService) checkUserRank(ctx context.Context, userID string, userRan
if err != nil {
return false, err
}
currentUserRank := userRank
if currentUserRank < requireRank {
if userRank < requireRank || requireRank < 0 {
log.Debugf("user %s want to do action %s, but rank %d < %d",
userID, action, currentUserRank, requireRank)
userID, action, userRank, requireRank)
return false, nil
}
return true, nil