修复redis.go中残留的consts引用

This commit is contained in:
Cold
2026-01-04 14:53:53 +08:00
committed by 张斌
parent c7f3a4d38d
commit a068e95017

View File

@@ -7,7 +7,6 @@ import (
"sync" "sync"
"time" "time"
"gitee.com/red-future---jilin-g/common/consts"
"github.com/gogf/gf/v2/database/gredis" "github.com/gogf/gf/v2/database/gredis"
"github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/glog" "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" // key: 限流key需要包含完整路径如 "ip:192.168.1.1"
// windowSeconds: 时间窗口(秒) // windowSeconds: 时间窗口(秒)
func IncrRateLimit(ctx context.Context, key string, windowSeconds int64) (count int64, err error) { 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) result, err := redisClient.Do(ctx, "INCR", fullKey)
if err != nil { if err != nil {
return return
@@ -516,7 +515,7 @@ func IncrRateLimit(ctx context.Context, key string, windowSeconds int64) (count
// GetRateLimit 获取当前限流计数 // GetRateLimit 获取当前限流计数
func GetRateLimit(ctx context.Context, key string) (count int64, err error) { func GetRateLimit(ctx context.Context, key string) (count int64, err error) {
fullKey := consts.RateLimitKeyPrefix + key fullKey := RateLimitKeyPrefix + key
result, err := redisClient.Get(ctx, fullKey) result, err := redisClient.Get(ctx, fullKey)
if err != nil { if err != nil {
return return