修复redis.go中残留的consts引用
This commit is contained in:
@@ -7,7 +7,6 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"gitee.com/red-future---jilin-g/common/consts"
|
||||
"github.com/gogf/gf/v2/database/gredis"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/glog"
|
||||
@@ -500,7 +499,7 @@ func IsUserActive(ctx context.Context, userId string, seconds int64) (bool, erro
|
||||
// key: 限流key(需要包含完整路径,如 "ip:192.168.1.1")
|
||||
// windowSeconds: 时间窗口(秒)
|
||||
func IncrRateLimit(ctx context.Context, key string, windowSeconds int64) (count int64, err error) {
|
||||
fullKey := consts.RateLimitKeyPrefix + key
|
||||
fullKey := RateLimitKeyPrefix + key
|
||||
result, err := redisClient.Do(ctx, "INCR", fullKey)
|
||||
if err != nil {
|
||||
return
|
||||
@@ -516,7 +515,7 @@ func IncrRateLimit(ctx context.Context, key string, windowSeconds int64) (count
|
||||
|
||||
// GetRateLimit 获取当前限流计数
|
||||
func GetRateLimit(ctx context.Context, key string) (count int64, err error) {
|
||||
fullKey := consts.RateLimitKeyPrefix + key
|
||||
fullKey := RateLimitKeyPrefix + key
|
||||
result, err := redisClient.Get(ctx, fullKey)
|
||||
if err != nil {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user