From a88315ee7461eeeb7da0a69f092621cde0535787 Mon Sep 17 00:00:00 2001 From: yubo Date: Wed, 13 Jan 2021 12:34:44 +0800 Subject: [PATCH] bugfix: call collect.Decode before get() (#507) * add models.user.i18n * bugfix: call collect.Decode before get() --- src/models/mon_collect_rule.go | 6 +++--- src/modules/monapi/plugins/api/api.go | 1 + src/modules/monapi/plugins/log/log.go | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/models/mon_collect_rule.go b/src/models/mon_collect_rule.go index 6d9fc265..0ca5ee89 100644 --- a/src/models/mon_collect_rule.go +++ b/src/models/mon_collect_rule.go @@ -24,9 +24,9 @@ type CollectRule struct { Data json.RawMessage `json:"data"` Tags string `json:"tags" description:"k1=v1,k2=v2,k3=v3,..."` Creator string `json:"creator" description:"just for output"` - LastUpdator string `xorm:"last_updator" json:"last_updator" description:"just for output"` - Created time.Time `xorm:"updated" json:"created" description:"just for output"` - LastUpdated time.Time `xorm:"updated" json:"last_updated" description:"just for output"` + LastUpdator string `json:"last_updator" description:"just for output"` + Created time.Time `json:"created" description:"just for output"` + LastUpdated time.Time `json:"last_updated" description:"just for output"` } type validator interface { diff --git a/src/modules/monapi/plugins/api/api.go b/src/modules/monapi/plugins/api/api.go index 81431a52..2630fdd2 100644 --- a/src/modules/monapi/plugins/api/api.go +++ b/src/modules/monapi/plugins/api/api.go @@ -29,6 +29,7 @@ func (p ApiCollector) Get(id int64) (interface{}, error) { if !has { return nil, err } + collect.Decode() return collect, err } diff --git a/src/modules/monapi/plugins/log/log.go b/src/modules/monapi/plugins/log/log.go index 06b7c362..90fae047 100644 --- a/src/modules/monapi/plugins/log/log.go +++ b/src/modules/monapi/plugins/log/log.go @@ -29,6 +29,7 @@ func (p LogCollector) Get(id int64) (interface{}, error) { if !has { return nil, err } + collect.Decode() return collect, err }