From 0243d75335d7869b3049827cdcf620c7c6e8ad16 Mon Sep 17 00:00:00 2001 From: chenyifan01 Date: Mon, 11 Jul 2022 18:13:47 +0800 Subject: [PATCH] #2225 update --- services/reward/limiter/config.go | 4 ++-- services/reward/limiter/limiter.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/services/reward/limiter/config.go b/services/reward/limiter/config.go index d90cf0aac..d40cd728c 100644 --- a/services/reward/limiter/config.go +++ b/services/reward/limiter/config.go @@ -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, } diff --git a/services/reward/limiter/limiter.go b/services/reward/limiter/limiter.go index c303a1ef3..7e3607785 100644 --- a/services/reward/limiter/limiter.go +++ b/services/reward/limiter/limiter.go @@ -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