waf/ip名单有变更立即发送通知

This commit is contained in:
刘祥超
2020-11-10 09:22:10 +08:00
parent e8e1d3a4bd
commit d7fb936003
5 changed files with 50 additions and 2 deletions

View File

@@ -46,9 +46,15 @@ func (this *IPItemDAO) EnableIPItem(id int64) error {
// 禁用条目
func (this *IPItemDAO) DisableIPItem(id int64) error {
_, err := this.Query().
version, err := SharedIPListDAO.IncreaseVersion()
if err != nil {
return err
}
_, err = this.Query().
Pk(id).
Set("state", IPItemStateDisabled).
Set("version", version).
Update()
return err
}

View File

@@ -12,6 +12,7 @@ type IPList struct {
State uint8 `field:"state"` // 状态
CreatedAt uint64 `field:"createdAt"` // 创建时间
Timeout string `field:"timeout"` // 默认超时时间
Actions string `field:"actions"` // IP触发的动作
}
type IPListOperator struct {
@@ -25,6 +26,7 @@ type IPListOperator struct {
State interface{} // 状态
CreatedAt interface{} // 创建时间
Timeout interface{} // 默认超时时间
Actions interface{} // IP触发的动作
}
func NewIPListOperator() *IPListOperator {