Browse Source

#2225

update
tags/v1.22.9.2^2
chenyifan01 3 years ago
parent
commit
0243d75335
2 changed files with 4 additions and 4 deletions
  1. +2
    -2
      services/reward/limiter/config.go
  2. +2
    -2
      services/reward/limiter/limiter.go

+ 2
- 2
services/reward/limiter/config.go View File

@@ -11,7 +11,7 @@ func GetSingleDailyPointLimitConfig() (*models.LimitConfigVO, error) {
r, err := GetLimitConfigList(models.LimitConfigQueryOpts{
RefreshRate: models.PeriodDaily,
Scope: models.LimitScopeSingleUser,
LimitCode: "",
LimitCode: models.SourceTypeAccomplishTask.Name(),
LimitType: models.LimitTypeRewardPoint,
})
if err != nil {
@@ -27,7 +27,7 @@ func SetSingleDailyPointLimitConfig(limitNum int64, doer *models.User) error {
l := &models.LimitConfigVO{
RefreshRate: models.PeriodDaily,
Scope: models.LimitScopeSingleUser.Name(),
LimitCode: "",
LimitCode: models.SourceTypeAccomplishTask.Name(),
LimitType: models.LimitTypeRewardPoint.Name(),
LimitNum: limitNum,
}


+ 2
- 2
services/reward/limiter/limiter.go View File

@@ -150,7 +150,7 @@ func (l *limiterRunner) limit(r models.LimitConfig) error {
if usedNum > r.LimitNum {
if usedNum-r.LimitNum >= l.amount {
redis_client.IncrBy(redisKey, -1*l.amount)
return errors.New(fmt.Sprintf("%s:over limit", r.Tittle))
return errors.New(fmt.Sprintf("over limit,congfigId=%d", r.ID))
}
switch l.rejectPolicy {
case models.FillUp:
@@ -161,7 +161,7 @@ func (l *limiterRunner) limit(r models.LimitConfig) error {
return nil
case models.JustReject:
redis_client.IncrBy(redisKey, -1*l.amount)
return errors.New(fmt.Sprintf("%s:over limit", r.Tittle))
return errors.New(fmt.Sprintf("over limit,congfigId=%d", r.ID))
case models.PermittedOnce:
l.resultMap[l.index] = newLimitResult(false, l.amount, l.amount)
return nil


Loading…
Cancel
Save