初始化项目
This commit is contained in:
35
model/dto/rate_limit_dto.go
Normal file
35
model/dto/rate_limit_dto.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// SetTenantRateLimitReq 设置租户限流配置请求
|
||||
type SetTenantRateLimitReq struct {
|
||||
g.Meta `path:"/ratelimit-tenant-set" method:"post" tags:"租户限流" summary:"设置租户限流配置" dc:"设置指定租户的请求次数限制配置(实际使用全局配置)"`
|
||||
|
||||
TenantID int64 `json:"tenant_id" v:"required"` // 租户ID(仅用于记录,实际使用全局配置)
|
||||
RequestsPerSecond float64 `json:"requests_per_second" v:"required"` // 每秒请求数
|
||||
Burst int `json:"burst" v:"required"` // 突发请求数
|
||||
WindowSeconds int `json:"window_seconds" v:"required"` // 时间窗口(秒)
|
||||
}
|
||||
|
||||
// SetTenantRateLimitRes 设置租户限流配置响应
|
||||
type SetTenantRateLimitRes struct {
|
||||
Success bool `json:"success"` // 是否成功
|
||||
}
|
||||
|
||||
// GetTenantRateLimitUsageReq 获取租户限流使用情况请求
|
||||
type GetTenantRateLimitUsageReq struct {
|
||||
g.Meta `path:"/ratelimit-tenant-usage" method:"get" tags:"租户限流" summary:"获取租户限流使用情况" dc:"获取指定租户的请求次数使用情况"`
|
||||
|
||||
TenantID int64 `json:"tenant_id" v:"required"` // 租户ID
|
||||
}
|
||||
|
||||
// GetTenantRateLimitUsageRes 获取租户限流使用情况响应
|
||||
type GetTenantRateLimitUsageRes struct {
|
||||
TenantID int64 `json:"tenant_id"` // 租户ID
|
||||
CurrentUsed int64 `json:"current_used"` // 当前已使用请求数
|
||||
MaxAllowed int64 `json:"max_allowed"` // 最大允许请求数(基于全局配置)
|
||||
UsagePercent float64 `json:"usage_percent"` // 使用率百分比
|
||||
}
|
||||
Reference in New Issue
Block a user