From a068e95017f351a74f741611e799965637adf8e8 Mon Sep 17 00:00:00 2001 From: Cold <16419454+cold502@user.noreply.gitee.com> Date: Sun, 4 Jan 2026 14:53:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dredis.go=E4=B8=AD=E6=AE=8B?= =?UTF-8?q?=E7=95=99=E7=9A=84consts=E5=BC=95=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- redis/redis.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/redis/redis.go b/redis/redis.go index c112d41..38b372a 100644 --- a/redis/redis.go +++ b/redis/redis.go @@ -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