This commit is contained in:
2025-11-16 18:46:22 +08:00
parent 9d9a2545f9
commit 46a19c12fa
12 changed files with 101 additions and 101 deletions

View File

@@ -47,7 +47,7 @@ func GetUnusedImages() ([]model.Image, error) {
Where("NOT EXISTS (SELECT 1 FROM resource_images WHERE image_id = images.id)").
Where("NOT EXISTS (SELECT 1 FROM comment_images WHERE image_id = images.id)").
Where("NOT EXISTS (SELECT 1 FROM collection_images WHERE image_id = images.id)").
Where("NOT EXISTS (SELECT 1 FROM charactors WHERE image_id = images.id)").
Where("NOT EXISTS (SELECT 1 FROM characters WHERE image_id = images.id)").
Where("created_at < ?", oneDayAgo).
Find(&images).Error; err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {