Files
kami_backend/internal/service/limiter.go
danial 15e2426e85 feat(camel_oil): 新增骆驼加油账号管理模块
- 实现账号增删改查接口和逻辑
- 支持账号状态更新及状态历史记录功能
- 提供账号列表、历史和统计信息查询API
- 实现账号轮询机制,支持按使用时间轮询获取账号
- 增加账号登录流程及批量登录功能,集成接码平台和平台API
- 管理账号订单容量,支持容量检查与账号登录触发
- 提供账号池状态统计接口
- 账号历史记录查询支持多种变更类型文本展示
- 密码等敏感信息采用脱敏展示
- 完善日志记录和错误处理机制,保证业务稳定运行
2025-11-21 00:49:50 +08:00

46 lines
1.5 KiB
Go

// ================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// You can delete these comments if you wish manually maintain this interface file.
// ================================================================================
package service
import (
"context"
"kami/internal/model"
)
type (
IRate interface {
// Check 检查限流
Check(ctx context.Context, limiterType model.LimiterType, key string) *model.LimiterResult
// CheckWithConfig 使用自定义配置检查限流
CheckWithConfig(ctx context.Context, config *model.LimiterConfig, key string) *model.LimiterResult
// Allow 简单的限流检查,返回是否允许通过
Allow(ctx context.Context, limiterType model.LimiterType, key string) bool
// GetLimiterConfig 获取限流器配置
GetLimiterConfig(limiterType model.LimiterType) *model.LimiterConfig
// SetLimiterConfig 设置限流器配置(运行时修改)
SetLimiterConfig(limiterType model.LimiterType, config *model.LimiterConfig) error
// Reset 重置指定key的限流计数
Reset(ctx context.Context, limiterType model.LimiterType, key string) error
// GetRemaining 获取剩余可用次数
GetRemaining(ctx context.Context, limiterType model.LimiterType, key string) int
}
)
var (
localRate IRate
)
func Rate() IRate {
if localRate == nil {
panic("implement not found for interface IRate, forgot register?")
}
return localRate
}
func RegisterRate(i IRate) {
localRate = i
}