修复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"
"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