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>
72 lines
2.2 KiB
Go
72 lines
2.2 KiB
Go
package routes
|
|
|
|
import (
|
|
"github.com/gofiber/fiber/v2"
|
|
|
|
"github.com/break/junhong_cmp_fiber/internal/handler/admin"
|
|
"github.com/break/junhong_cmp_fiber/internal/model/dto"
|
|
"github.com/break/junhong_cmp_fiber/pkg/openapi"
|
|
)
|
|
|
|
// registerPollingConfigRoutes 注册轮询配置管理路由
|
|
func registerPollingConfigRoutes(router fiber.Router, handler *admin.PollingConfigHandler, doc *openapi.Generator, basePath string) {
|
|
configs := router.Group("/polling-configs")
|
|
groupPath := basePath + "/polling-configs"
|
|
|
|
Register(configs, doc, groupPath, "GET", "", handler.List, RouteSpec{
|
|
Summary: "获取轮询配置列表",
|
|
Tags: []string{"轮询配置管理"},
|
|
Input: new(dto.PollingConfigListRequest),
|
|
Output: new(dto.PollingConfigPageResult),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(configs, doc, groupPath, "POST", "", handler.Create, RouteSpec{
|
|
Summary: "创建轮询配置",
|
|
Tags: []string{"轮询配置管理"},
|
|
Input: new(dto.CreatePollingConfigRequest),
|
|
Output: new(dto.PollingConfigResponse),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(configs, doc, groupPath, "GET", "/enabled", handler.ListEnabled, RouteSpec{
|
|
Summary: "获取所有启用的配置",
|
|
Tags: []string{"轮询配置管理"},
|
|
Input: nil,
|
|
Output: []dto.PollingConfigResponse{},
|
|
Auth: true,
|
|
})
|
|
|
|
Register(configs, doc, groupPath, "GET", "/:id", handler.Get, RouteSpec{
|
|
Summary: "获取轮询配置详情",
|
|
Tags: []string{"轮询配置管理"},
|
|
Input: new(dto.IDReq),
|
|
Output: new(dto.PollingConfigResponse),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(configs, doc, groupPath, "PUT", "/:id", handler.Update, RouteSpec{
|
|
Summary: "更新轮询配置",
|
|
Tags: []string{"轮询配置管理"},
|
|
Input: new(dto.UpdatePollingConfigParams),
|
|
Output: new(dto.PollingConfigResponse),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(configs, doc, groupPath, "DELETE", "/:id", handler.Delete, RouteSpec{
|
|
Summary: "删除轮询配置",
|
|
Tags: []string{"轮询配置管理"},
|
|
Input: new(dto.IDReq),
|
|
Output: nil,
|
|
Auth: true,
|
|
})
|
|
|
|
Register(configs, doc, groupPath, "PUT", "/:id/status", handler.UpdateStatus, RouteSpec{
|
|
Summary: "更新轮询配置状态",
|
|
Tags: []string{"轮询配置管理"},
|
|
Input: new(dto.UpdatePollingConfigStatusParams),
|
|
Output: nil,
|
|
Auth: true,
|
|
})
|
|
}
|