fix: pg sql error #67

This commit is contained in:
engigu
2026-03-25 20:43:52 +08:00
parent e84a8f0d58
commit 6c8aba2327
4 changed files with 12 additions and 12 deletions
+2 -2
View File
@@ -417,7 +417,7 @@ func (s *BackupService) addDirToZip(zipWriter *zip.Writer, srcDir, prefix string
func (s *BackupService) GetBackupFile() string {
var setting models.Setting
res := database.DB.Where("section = ? AND `key` = ?", BackupSection, BackupFileKey).Limit(1).Find(&setting)
res := database.DB.Where(&models.Setting{Section: BackupSection, Key: BackupFileKey}).Limit(1).Find(&setting)
if res.Error != nil || res.RowsAffected == 0 {
return ""
}
@@ -428,7 +428,7 @@ func (s *BackupService) ClearBackup() error {
filePath := s.GetBackupFile()
if filePath != "" {
os.Remove(filePath)
database.DB.Where("section = ? AND `key` = ?", BackupSection, BackupFileKey).Delete(&models.Setting{})
database.DB.Where(&models.Setting{Section: BackupSection, Key: BackupFileKey}).Delete(&models.Setting{})
}
return nil
}