diff --git a/internal/db/models/node_ip_address_threshold_dao.go b/internal/db/models/node_ip_address_threshold_dao.go index 9841763b..ba258a6a 100644 --- a/internal/db/models/node_ip_address_threshold_dao.go +++ b/internal/db/models/node_ip_address_threshold_dao.go @@ -242,3 +242,11 @@ func (this *NodeIPAddressThresholdDAO) ExistsEnabledThreshold(tx *dbs.Tx, thresh State(NodeIPAddressThresholdStateEnabled). Exist() } + +// UpdateThresholdIsMatched 设置是否匹配 +func (this *NodeIPAddressThresholdDAO) UpdateThresholdIsMatched(tx *dbs.Tx, thresholdId int64, isMatched bool) error { + return this.Query(tx). + Pk(thresholdId). + Set("isMatched", isMatched). + UpdateQuickly() +} diff --git a/internal/db/models/node_ip_address_threshold_model.go b/internal/db/models/node_ip_address_threshold_model.go index b588300a..f6bd5b3d 100644 --- a/internal/db/models/node_ip_address_threshold_model.go +++ b/internal/db/models/node_ip_address_threshold_model.go @@ -7,6 +7,7 @@ type NodeIPAddressThreshold struct { Items string `field:"items"` // 阈值条目 Actions string `field:"actions"` // 动作 NotifiedAt uint64 `field:"notifiedAt"` // 上次通知时间 + IsMatched uint8 `field:"isMatched"` // 上次是否匹配 State uint8 `field:"state"` // 状态 Order uint32 `field:"order"` // 排序 } @@ -17,6 +18,7 @@ type NodeIPAddressThresholdOperator struct { Items interface{} // 阈值条目 Actions interface{} // 动作 NotifiedAt interface{} // 上次通知时间 + IsMatched interface{} // 上次是否匹配 State interface{} // 状态 Order interface{} // 排序 } diff --git a/internal/db/models/sys_setting_dao.go b/internal/db/models/sys_setting_dao.go index ff15f34d..d73f1a5e 100644 --- a/internal/db/models/sys_setting_dao.go +++ b/internal/db/models/sys_setting_dao.go @@ -32,7 +32,7 @@ func init() { }) } -// 设置配置 +// UpdateSetting 设置配置 func (this *SysSettingDAO) UpdateSetting(tx *dbs.Tx, codeFormat string, valueJSON []byte, codeFormatArgs ...interface{}) error { if len(codeFormatArgs) > 0 { codeFormat = fmt.Sprintf(codeFormat, codeFormatArgs...) @@ -77,7 +77,7 @@ func (this *SysSettingDAO) UpdateSetting(tx *dbs.Tx, codeFormat string, valueJSO return lastErr } -// 读取配置 +// ReadSetting 读取配置 func (this *SysSettingDAO) ReadSetting(tx *dbs.Tx, code string, codeFormatArgs ...interface{}) (valueJSON []byte, err error) { if len(codeFormatArgs) > 0 { code = fmt.Sprintf(code, codeFormatArgs...) @@ -89,7 +89,7 @@ func (this *SysSettingDAO) ReadSetting(tx *dbs.Tx, code string, codeFormatArgs . return []byte(col), err } -// 对比配置中的数字大小 +// CompareInt64Setting 对比配置中的数字大小 func (this *SysSettingDAO) CompareInt64Setting(tx *dbs.Tx, code string, anotherValue int64) (int8, error) { valueJSON, err := this.ReadSetting(tx, code) if err != nil { @@ -105,7 +105,7 @@ func (this *SysSettingDAO) CompareInt64Setting(tx *dbs.Tx, code string, anotherV return 0, nil } -// 读取全局配置 +// ReadGlobalConfig 读取全局配置 func (this *SysSettingDAO) ReadGlobalConfig(tx *dbs.Tx) (*serverconfigs.GlobalConfig, error) { globalConfigData, err := this.ReadSetting(tx, systemconfigs.SettingCodeServerGlobalConfig) if err != nil {