Commit 4e7c0e79 authored by 黄智's avatar 黄智

Merge remote-tracking branch 'origin/dev' into dev

parents e2497ab6 f570d1c3
......@@ -18,7 +18,7 @@ type AlertRules struct {
NotifyRecipients string `json:"notify_recipients" xorm:"notify_recipients"` // 预警推送用户
NotifyPushCount int `json:"notify_push_count" xorm:"'notify_push_count'"` // 消息推送次数
NotifyPushFrequency int `json:"notify_push_frequency" xorm:"'notify_push_frequency'"` // 消息推送频率 分钟
IsEnabled int `json:"is_enabled" xorm:"'is_enabled'"` // 是否开启 0:关闭 1:启动
IsEnabled int `json:"is_enabled" xorm:"'is_enabled'"` // 是否开启 1:是 2:否
CreatedBy string `json:"created_by" xorm:"'created_by'"` // 创建人
CreatedAt jsontime.Time `json:"created_at" xorm:"'created_at'"` // 创建时间
UpdatedBy string `json:"updated_by" xorm:"'updated_by'"` // 更新人
......
......@@ -11,7 +11,7 @@ type MetricConfig struct {
Duration int `json:"duration" xorm:"'duration'"` // 持续时间
DurationUnit string `json:"duration_unit" xorm:"'duration_unit'"` // 持续时间单位 s m h
CheckPeriod int `json:"check_period" xorm:"'check_period'"` // 检查周期 单位:分钟
IsEnabled int `json:"is_enabled" xorm:"'is_enabled'"` // 是否开启 0:关闭 1:启动
IsEnabled int `json:"is_enabled" xorm:"'is_enabled'"` // 是否开启 1:是 2:否
AlertRuleType string `json:"alert_rule_type" xorm:"'alert_rule_type'"` // 预警规则类型 关联字典表
SourceFrom int `json:"source_from" xorm:"source_from"` // 数据来源 1:默认 2:自定义
CreatedBy string `json:"created_by" xorm:"'created_by'"` // 创建人
......
......@@ -67,7 +67,7 @@ type ListAlertRules struct {
// 请输入预警规则名称/预警对象/预警分类/预警指标
Id string `json:"id" form:"id"`
NotifyMethod string `json:"notify_method" form:"notify_method" binding:"omitempty,oneof=all dingtalk sms"` // 预警通知方式 all dingtalk sms
IsEnabled int `json:"is_enabled" form:"is_enabled" binding:"omitempty,oneof=0 1 2"` // 是否开启 1:是 2:否
IsEnabled int `json:"is_enabled" form:"is_enabled" binding:"omitempty,oneof=1 2"` // 是否开启 1:是 2:否
Keyword string `json:"keyword" form:"keyword"` // 预警规则名称(指标名称)
StartTime string `json:"start_time" form:"start_time" binding:"omitempty,datetime=2006-01-02 15:04:05"`
EndTime string `json:"end_time" form:"end_time" binding:"omitempty,datetime=2006-01-02 15:04:05"`
......
......@@ -10,7 +10,7 @@ type AddMetricConfig struct {
Duration int `json:"duration" form:"duration"` // 持续时间
DurationUnit string `json:"duration_unit" form:"duration_unit" binding:"required,oneof=s m h"` // 持续时间单位 s m h
CheckPeriod int `json:"check_period" form:"check_period" binding:"oneof=1 3 5 10 20 30"` // 检查周期 单位:分钟
IsEnabled int `json:"is_enabled" form:"is_enabled" binding:"omitempty,oneof=0 1 2"` // 是否开启 1:是 2:否
IsEnabled int `json:"is_enabled" form:"is_enabled" binding:"omitempty,oneof=1 2"` // 是否开启 1:是 2:否
AlertRuleType string `json:"alert_rule_type" form:"alert_rule_type" binding:"required"` // 预警规则类型 关联字典表
SourceFrom int `json:"source_from" form:"source_from" binding:"omitempty,oneof=1 2"` // 数据来源 1:默认 2:自定义
}
......@@ -24,7 +24,7 @@ type UpdateMetricConfig struct {
Duration int `json:"duration" form:"duration"` // 持续时间
DurationUnit string `json:"duration_unit" form:"duration_unit" binding:"omitempty,oneof=s m h"` // 持续时间单位 s m h
CheckPeriod int `json:"check_period" form:"check_period" binding:"omitempty,oneof=1 3 5 10 20 30"` // 检查周期 单位:分钟
IsEnabled int `json:"is_enabled" form:"is_enabled" binding:"omitempty,oneof=0 1 2"` // 是否开启 1:是 2:否
IsEnabled int `json:"is_enabled" form:"is_enabled" binding:"omitempty,oneof=1 2"` // 是否开启 1:是 2:否
AlertRuleType string `json:"alert_rule_type" form:"alert_rule_type"` // 预警规则类型 关联字典表
SourceFrom int `json:"source_from" form:"source_from" binding:"omitempty,oneof=1 2"` // 数据来源 1:默认 2:自定义
}
......@@ -39,9 +39,11 @@ type DetailMetricConfig struct {
}
type ListMetricConfig struct {
Id string `json:"id" form:"id"`
ClassId int `json:"class_id" form:"class_id"`
MetricName string `json:"metric_name" form:"metric_name"`
IsEnabled int `json:"is_enabled" form:"is_enabled" binding:"omitempty,oneof=0 1 2"`
Id string `json:"id" form:"id"` // 主键id
ClassId int `json:"class_id" form:"class_id"` // 分类id
MetricName string `json:"metric_name" form:"metric_name"` // 指标名称
IsEnabled int `json:"is_enabled" form:"is_enabled" binding:"omitempty,oneof=1 2"` // 是否开启 1:是 2:否
StartTime string `json:"start_time" form:"start_time" binding:"omitempty,datetime=2006-01-02 15:04:05"` // 开始时间
EndTime string `json:"end_time" form:"end_time" binding:"omitempty,datetime=2006-01-02 15:04:05"` // 结束时间
Pagination
}
......@@ -78,6 +78,12 @@ func (m *MetricConfigSvc) List(req request.ListMetricConfig) (resp response.Metr
if req.IsEnabled != 0 {
session.Where("is_enabled = ?", req.IsEnabled)
}
if req.StartTime != "" {
session.Where("created_at >= ?", req.StartTime)
}
if req.EndTime != "" {
session.Where("created_at <= ?", req.EndTime)
}
resp.TotalCount, err = session.Limit(req.GetPageSize(), (req.GetPage()-1)*req.GetPageSize()).
OrderBy("id").FindAndCount(&resp.List)
return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment