mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-02 03:40:27 +08:00
优化代码
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user