diff --git a/pkg/cloudcommon/db/resourcebase.go b/pkg/cloudcommon/db/resourcebase.go index 9f6e4dbe3c..686ccb60dd 100644 --- a/pkg/cloudcommon/db/resourcebase.go +++ b/pkg/cloudcommon/db/resourcebase.go @@ -48,6 +48,10 @@ type SResourceBaseManager struct { SModelBaseManager } +func (model *SResourceBase) GetCreatedAt() time.Time { + return model.CreatedAt +} + func NewResourceBaseManager(dt interface{}, tableName string, keyword string, keywordPlural string) SResourceBaseManager { return SResourceBaseManager{NewModelBaseManager(dt, tableName, keyword, keywordPlural)} } diff --git a/pkg/compute/models/billingresourcecheck.go b/pkg/compute/models/billingresourcecheck.go index f7afe7fd5a..54fa21482a 100644 --- a/pkg/compute/models/billingresourcecheck.go +++ b/pkg/compute/models/billingresourcecheck.go @@ -61,6 +61,7 @@ type IBillingModel interface { GetExpiredAt() time.Time GetReleaseAt() time.Time GetAutoRenew() bool + GetCreatedAt() time.Time SetReleaseAt(releaseAt time.Time) SetExpiredAt(expireAt time.Time) SetBillingCycle(billingCycle string) @@ -208,6 +209,7 @@ func (bm *SBillingResourceCheckManager) Create(ctx context.Context, res IBilling bc.ProjectId = owner.GetProjectId() bc.DomainId = owner.GetDomainId() } + bc.CreatedAt = res.GetCreatedAt() bc.Status = res.GetStatus() bc.SetModelManager(bm, bc) return bm.TableSpec().InsertOrUpdate(ctx, bc)