From 26b47bae69a18c47d8fcc2182780963b05c40639 Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Wed, 23 Oct 2024 10:46:17 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E5=BF=AB=E7=85=A7?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=8E=92=E5=BA=8F=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20(#6816)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs #6810 --- backend/app/dto/setting.go | 2 +- backend/app/service/cronjob_backup.go | 10 ++++++++++ frontend/src/api/interface/setting.ts | 2 +- frontend/src/views/setting/snapshot/index.vue | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/backend/app/dto/setting.go b/backend/app/dto/setting.go index 423e84c57..78e0ffef1 100644 --- a/backend/app/dto/setting.go +++ b/backend/app/dto/setting.go @@ -149,7 +149,7 @@ type SnapshotInfo struct { DefaultDownload string `json:"defaultDownload"` Status string `json:"status"` Message string `json:"message"` - CreatedAt time.Time `json:"createdAt"` + CreatedAt time.Time `json:"created_at"` Version string `json:"version"` InterruptStep string `json:"interruptStep"` diff --git a/backend/app/service/cronjob_backup.go b/backend/app/service/cronjob_backup.go index c3e2c77df..4ecdefb8a 100644 --- a/backend/app/service/cronjob_backup.go +++ b/backend/app/service/cronjob_backup.go @@ -1,6 +1,7 @@ package service import ( + "errors" "fmt" "os" "path" @@ -30,6 +31,9 @@ func (u *CronjobService) handleApp(cronjob model.Cronjob, startTime time.Time) e if err != nil { return err } + if len(appItems) == 0 { + return errors.New("no such app in database!") + } apps = appItems } accountMap, err := loadClientMap(cronjob.BackupAccounts) @@ -65,6 +69,9 @@ func (u *CronjobService) handleApp(cronjob model.Cronjob, startTime time.Time) e func (u *CronjobService) handleWebsite(cronjob model.Cronjob, startTime time.Time) error { webs := loadWebsForJob(cronjob) + if len(webs) == 0 { + return errors.New("no such website in database!") + } accountMap, err := loadClientMap(cronjob.BackupAccounts) if err != nil { return err @@ -98,6 +105,9 @@ func (u *CronjobService) handleWebsite(cronjob model.Cronjob, startTime time.Tim func (u *CronjobService) handleDatabase(cronjob model.Cronjob, startTime time.Time) error { dbs := loadDbsForJob(cronjob) + if len(dbs) == 0 { + return errors.New("no such db in database!") + } accountMap, err := loadClientMap(cronjob.BackupAccounts) if err != nil { return err diff --git a/frontend/src/api/interface/setting.ts b/frontend/src/api/interface/setting.ts index 1dc0da83c..a85dfe0d2 100644 --- a/frontend/src/api/interface/setting.ts +++ b/frontend/src/api/interface/setting.ts @@ -135,7 +135,7 @@ export namespace Setting { description: string; status: string; message: string; - createdAt: DateTimeFormats; + created_at: DateTimeFormats; version: string; interruptStep: string; recoverStatus: string; diff --git a/frontend/src/views/setting/snapshot/index.vue b/frontend/src/views/setting/snapshot/index.vue index ec017cc26..f7e2d16d8 100644 --- a/frontend/src/views/setting/snapshot/index.vue +++ b/frontend/src/views/setting/snapshot/index.vue @@ -110,7 +110,7 @@