feat: 实现 IoT 卡轮询系统(支持千万级卡规模)
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 6m35s

实现功能:
- 实名状态检查轮询(可配置间隔)
- 卡流量检查轮询(支持跨月流量追踪)
- 套餐检查与超额自动停机
- 分布式并发控制(Redis 信号量)
- 手动触发轮询(单卡/批量/条件筛选)
- 数据清理配置与执行
- 告警规则与历史记录
- 实时监控统计(队列/性能/并发)

性能优化:
- Redis 缓存卡信息,减少 DB 查询
- Pipeline 批量写入 Redis
- 异步流量记录写入
- 渐进式初始化(10万卡/批)

压测工具(scripts/benchmark/):
- Mock Gateway 模拟上游服务
- 测试卡生成器
- 配置初始化脚本
- 实时监控脚本

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-05 17:32:44 +08:00
parent b11edde720
commit 931e140e8e
104 changed files with 16883 additions and 87 deletions

View File

@@ -0,0 +1,32 @@
package dto
// GetPollingConcurrencyReq 获取指定任务类型的并发配置请求
type GetPollingConcurrencyReq struct {
TaskType string `path:"task_type" description:"任务类型" required:"true"`
}
// UpdatePollingConcurrencyReq 更新轮询并发配置请求
type UpdatePollingConcurrencyReq struct {
TaskType string `path:"task_type" description:"任务类型" required:"true"`
MaxConcurrency int `json:"max_concurrency" validate:"required,min=1,max=1000" description:"最大并发数1-1000"`
}
// PollingConcurrencyResp 轮询并发配置响应
type PollingConcurrencyResp struct {
TaskType string `json:"task_type" description:"任务类型"`
TaskTypeName string `json:"task_type_name" description:"任务类型名称"`
MaxConcurrency int `json:"max_concurrency" description:"最大并发数"`
Current int64 `json:"current" description:"当前并发数"`
Available int64 `json:"available" description:"可用并发数"`
Utilization float64 `json:"utilization" description:"使用率(百分比)"`
}
// PollingConcurrencyListResp 轮询并发配置列表响应
type PollingConcurrencyListResp struct {
Items []*PollingConcurrencyResp `json:"items" description:"并发配置列表"`
}
// ResetPollingConcurrencyReq 重置轮询并发计数请求
type ResetPollingConcurrencyReq struct {
TaskType string `json:"task_type" validate:"required" description:"任务类型"`
}