fix: 解决计划任务清除所有数据失败的问题 (#597)

pull/598/head
ssongliu 2023-04-12 16:26:30 +08:00 committed by GitHub
parent c63897ded4
commit b2e38c320d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -81,11 +81,11 @@ func (u *CronjobService) SearchRecords(search dto.SearchRecord) (int64, interfac
}
func (u *CronjobService) CleanRecord(req dto.CronjobClean) error {
if req.CleanData {
cronjob, err := cronjobRepo.Get(commonRepo.WithByID(req.CronjobID))
if err != nil {
return err
}
cronjob, err := cronjobRepo.Get(commonRepo.WithByID(req.CronjobID))
if err != nil {
return err
}
if req.CleanData && cronjob.Type != "shell" && cronjob.Type != "curl" {
cronjob.RetainCopies = 0
backup, err := backupRepo.Get(commonRepo.WithByID(uint(cronjob.TargetDirID)))
if err != nil {