From f47c9b96806b7b4e30cbf8ab651798853bd095c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Thu, 2 Feb 2023 16:13:44 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=84=E5=88=99=E9=85=8D=E7=BD=AE=E7=BB=93?= =?UTF-8?q?=E6=9E=84=E4=B8=AD=E5=A2=9E=E5=8A=A0isComposed=E5=B1=9E?= =?UTF-8?q?=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/db/models/http_firewall_rule_dao.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/db/models/http_firewall_rule_dao.go b/internal/db/models/http_firewall_rule_dao.go index d58c6fc7..a1f9a997 100644 --- a/internal/db/models/http_firewall_rule_dao.go +++ b/internal/db/models/http_firewall_rule_dao.go @@ -82,12 +82,12 @@ func (this *HTTPFirewallRuleDAO) ComposeFirewallRule(tx *dbs.Tx, ruleId int64) ( if rule == nil { return nil, nil } - config := &firewallconfigs.HTTPFirewallRule{} + var config = &firewallconfigs.HTTPFirewallRule{} config.Id = int64(rule.Id) config.IsOn = rule.IsOn config.Param = rule.Param - paramFilters := []*firewallconfigs.ParamFilter{} + var paramFilters = []*firewallconfigs.ParamFilter{} if IsNotNull(rule.ParamFilters) { err = json.Unmarshal(rule.ParamFilters, ¶mFilters) if err != nil { @@ -101,7 +101,7 @@ func (this *HTTPFirewallRuleDAO) ComposeFirewallRule(tx *dbs.Tx, ruleId int64) ( config.IsCaseInsensitive = rule.IsCaseInsensitive if IsNotNull(rule.CheckpointOptions) { - checkpointOptions := map[string]interface{}{} + var checkpointOptions = map[string]interface{}{} err = json.Unmarshal(rule.CheckpointOptions, &checkpointOptions) if err != nil { return nil, err @@ -109,6 +109,8 @@ func (this *HTTPFirewallRuleDAO) ComposeFirewallRule(tx *dbs.Tx, ruleId int64) ( config.CheckpointOptions = checkpointOptions } + config.IsComposed = firewallconfigs.CheckCheckpointIsComposed(config.Prefix()) + config.Description = rule.Description return config, nil