mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-11 04:50:25 +08:00
IP阈值动作增加WebHook
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
@@ -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{} // 排序
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user