优化限制提示

This commit is contained in:
NewName
2025-05-17 16:54:06 +08:00
parent 85182f9368
commit 57f3f5c38d

View File

@@ -256,7 +256,7 @@ func RateLimitMiddleware(limiter *IPRateLimiter) gin.HandlerFunc {
// 如果IP在黑名单中 // 如果IP在黑名单中
if !allowed { if !allowed {
c.JSON(403, gin.H{ c.JSON(403, gin.H{
"error": "您的IP已被限制访问", "error": "您已被限制访问",
}) })
c.Abort() c.Abort()
return return
@@ -265,7 +265,7 @@ func RateLimitMiddleware(limiter *IPRateLimiter) gin.HandlerFunc {
// 检查是否允许本次请求 // 检查是否允许本次请求
if !ipLimiter.Allow() { if !ipLimiter.Allow() {
c.JSON(429, gin.H{ c.JSON(429, gin.H{
"error": "请求频率过触发IP限流", "error": "请求频率过快,暂时限制访问",
}) })
c.Abort() c.Abort()
return return