Files
junhong_cmp_fiber/internal/model/dto/polling_alert_dto.go
huang 2ef8b8a705
Some checks failed
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Has been cancelled
fix: 修复分页字段/角色DTO/套餐详情/批量分配Bug,新增C端测试登录接口和Hurl价格验证测试
- 修复B-2:27个分页DTO字段名统一(list→items, page_size→size,删除total_pages)
- 修复B-1:角色接口统一返回DTO(id小写,消除GORM大写字段名)
- 修复C-1:套餐详情接口(GET /packages/:id)补充代理佣金字段
- 修复C-2:批量分配已存在记录由500改为静默跳过
- 修复C-3:创建系列授权响应在事务提交后构建,packages数组不再为空
- 新增C端开发测试登录接口(POST /api/c/v1/auth/dev-login,仅logging.development=true时生效)
- 新增Hurl测试:card-price-verification-flow.hurl(导入卡→分配→C端价格验证)
- 新增测试Excel数据文件和dev.env测试变量
2026-03-31 09:54:08 +08:00

84 lines
4.8 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package dto
import "time"
// CreatePollingAlertRuleReq 创建告警规则请求
type CreatePollingAlertRuleReq struct {
RuleName string `json:"rule_name" validate:"required,max=100" description:"规则名称"`
TaskType string `json:"task_type" validate:"required" description:"任务类型 (polling:realname/polling:carddata/polling:package)"`
MetricType string `json:"metric_type" validate:"required" description:"指标类型 (queue_size/success_rate/avg_duration/concurrency)"`
Operator string `json:"operator" validate:"omitempty,oneof=> >= < <= ==" description:"比较运算符,默认 >"`
Threshold float64 `json:"threshold" validate:"required" description:"阈值"`
AlertLevel string `json:"alert_level" validate:"required,oneof=warning critical" description:"告警级别 (warning/critical)"`
CooldownMinutes int `json:"cooldown_minutes" validate:"omitempty,min=0,max=1440" description:"冷却时间(分钟)默认5分钟"`
NotifyChannels string `json:"notify_channels" validate:"omitempty" description:"通知渠道(JSON格式)"`
}
// UpdatePollingAlertRuleReq 更新告警规则请求Body 部分)
type UpdatePollingAlertRuleReq struct {
RuleName *string `json:"rule_name" validate:"omitempty,max=100" description:"规则名称"`
Threshold *float64 `json:"threshold" validate:"omitempty" description:"阈值"`
AlertLevel *string `json:"alert_level" validate:"omitempty,oneof=warning critical" description:"告警级别"`
Status *int `json:"status" validate:"omitempty,oneof=0 1" description:"状态 (0:禁用, 1:启用)"`
CooldownMinutes *int `json:"cooldown_minutes" validate:"omitempty,min=0,max=1440" description:"冷却时间(分钟)"`
NotifyChannels *string `json:"notify_channels" validate:"omitempty" description:"通知渠道"`
}
// UpdatePollingAlertRuleParams 更新告警规则参数(包含路径参数和 Body
type UpdatePollingAlertRuleParams struct {
IDReq
UpdatePollingAlertRuleReq
}
// PollingAlertRuleResp 告警规则响应
type PollingAlertRuleResp struct {
ID uint `json:"id" description:"规则ID"`
RuleName string `json:"rule_name" description:"规则名称"`
TaskType string `json:"task_type" description:"任务类型"`
TaskTypeName string `json:"task_type_name" description:"任务类型名称"`
MetricType string `json:"metric_type" description:"指标类型"`
MetricTypeName string `json:"metric_type_name" description:"指标类型名称"`
Operator string `json:"operator" description:"比较运算符"`
Threshold float64 `json:"threshold" description:"阈值"`
AlertLevel string `json:"alert_level" description:"告警级别"`
Status int `json:"status" description:"状态 (0:禁用, 1:启用)"`
CooldownMinutes int `json:"cooldown_minutes" description:"冷却时间(分钟)"`
NotifyChannels string `json:"notify_channels" description:"通知渠道"`
CreatedAt time.Time `json:"created_at" description:"创建时间"`
UpdatedAt time.Time `json:"updated_at" description:"更新时间"`
}
// PollingAlertRuleListResp 告警规则列表响应
type PollingAlertRuleListResp struct {
Items []*PollingAlertRuleResp `json:"items" description:"告警规则列表"`
}
// PollingAlertHistoryResp 告警历史响应
type PollingAlertHistoryResp struct {
ID uint `json:"id" description:"历史ID"`
RuleID uint `json:"rule_id" description:"规则ID"`
RuleName string `json:"rule_name" description:"规则名称"`
TaskType string `json:"task_type" description:"任务类型"`
MetricType string `json:"metric_type" description:"指标类型"`
AlertLevel string `json:"alert_level" description:"告警级别"`
Threshold float64 `json:"threshold" description:"阈值"`
CurrentValue float64 `json:"current_value" description:"触发时的值"`
Message string `json:"message" description:"告警消息"`
CreatedAt time.Time `json:"created_at" description:"触发时间"`
}
// PollingAlertHistoryListResp 告警历史列表响应
type PollingAlertHistoryListResp struct {
Items []*PollingAlertHistoryResp `json:"items" description:"告警历史列表"`
Total int64 `json:"total" description:"总数"`
Page int `json:"page" description:"当前页"`
PageSize int `json:"size" description:"每页数量"`
}
// ListPollingAlertHistoryReq 查询告警历史请求
type ListPollingAlertHistoryReq struct {
RuleID *uint `json:"rule_id" query:"rule_id" description:"规则ID"`
Page int `json:"page" query:"page" validate:"omitempty,min=1" description:"页码"`
PageSize int `json:"page_size" query:"page_size" validate:"omitempty,min=1,max=100" description:"每页数量"`
}