fix: 解决计划任务备份下载路径错误的问题 (#3743)

This commit is contained in:
ssongliu 2024-01-29 18:52:38 +08:00 committed by GitHub
parent e309b9c030
commit 8b0d73b5d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 10 deletions

View File

@ -43,15 +43,15 @@ func (u *CronjobService) handleApp(cronjob model.Cronjob, startTime time.Time) e
if err := handleAppBackup(&app, backupDir, record.FileName); err != nil {
return err
}
if err := backupRepo.CreateRecord(&record); err != nil {
global.LOG.Errorf("save backup record failed, err: %v", err)
return err
}
downloadPath, err := u.uploadCronjobBackFile(cronjob, accountMap, path.Join(backupDir, record.FileName))
if err != nil {
return err
}
record.FileDir = path.Dir(downloadPath)
if err := backupRepo.CreateRecord(&record); err != nil {
global.LOG.Errorf("save backup record failed, err: %v", err)
return err
}
u.removeExpiredBackup(cronjob, accountMap, record)
}
return nil
@ -121,7 +121,6 @@ func (u *CronjobService) handleDatabase(cronjob model.Cronjob, startTime time.Ti
return err
}
record.FileDir = path.Dir(downloadPath)
if err := backupRepo.CreateRecord(&record); err != nil {
global.LOG.Errorf("save backup record failed, err: %v", err)
return err
@ -153,7 +152,6 @@ func (u *CronjobService) handleDirectory(cronjob model.Cronjob, startTime time.T
}
record.FileDir = path.Dir(downloadPath)
record.FileName = fileName
if err := backupRepo.CreateRecord(&record); err != nil {
global.LOG.Errorf("save backup record failed, err: %v", err)
return err
@ -184,7 +182,6 @@ func (u *CronjobService) handleSystemLog(cronjob model.Cronjob, startTime time.T
}
record.FileDir = path.Dir(downloadPath)
record.FileName = fileName
if err := backupRepo.CreateRecord(&record); err != nil {
global.LOG.Errorf("save backup record failed, err: %v", err)
return err

View File

@ -253,7 +253,7 @@
multiple
class="selectClass"
v-model="dialogData.rowData!.backupAccountList"
@change="changeAccount"
@change="changeAccount(true)"
>
<div v-for="item in backupOptions" :key="item.label">
<el-option :value="item.value" :label="item.label" />
@ -523,10 +523,10 @@ const loadBackups = async () => {
}
backupOptions.value.push({ label: i18n.global.t('setting.' + item.type), value: item.type });
}
changeAccount();
changeAccount(false);
};
const changeAccount = async () => {
const changeAccount = async (handleChange: boolean) => {
accountOptions.value = [];
for (const item of backupOptions.value) {
let exit = false;
@ -540,6 +540,9 @@ const changeAccount = async () => {
accountOptions.value.push(item);
}
}
if (handleChange) {
dialogData.value.rowData.defaultDownload = '';
}
};
const loadAppInstalls = async () => {