优化代码

This commit is contained in:
GoEdgeLab
2024-05-06 20:30:51 +08:00
parent 5fb2990735
commit 4dde0436a0

View File

@@ -118,6 +118,7 @@ func (this *UpdateSetPopupAction) RunPost(params struct {
if len(params.RulesJSON) == 0 {
this.Fail("请添加至少一个规则")
return
}
var rules = []*firewallconfigs.HTTPFirewallRule{}
err = json.Unmarshal(params.RulesJSON, &rules)
@@ -127,6 +128,7 @@ func (this *UpdateSetPopupAction) RunPost(params struct {
}
if len(rules) == 0 {
this.Fail("请添加至少一个规则")
return
}
var actionConfigs = []*firewallconfigs.HTTPFirewallActionConfig{}
@@ -139,6 +141,7 @@ func (this *UpdateSetPopupAction) RunPost(params struct {
}
if len(actionConfigs) == 0 {
this.Fail("请添加至少一个动作")
return
}
setConfig.Name = params.Name
@@ -158,10 +161,6 @@ func (this *UpdateSetPopupAction) RunPost(params struct {
this.ErrorPage(err)
return
}
if err != nil {
this.ErrorPage(err)
return
}
this.Success()
}