切换批次和文件的 ID 类型为 UUID,更新相关逻辑和文档

This commit is contained in:
2026-01-14 13:30:50 +08:00
parent 5160ae78cc
commit 1ffa16cf48
11 changed files with 66 additions and 59 deletions

View File

@@ -57,9 +57,9 @@ func (s *BatchService) MarkAsExpired(batch *model.FileBatch) error {
return s.db.Model(batch).Update("status", "expired").Error
}
func (s *BatchService) DeleteBatch(ctx context.Context, batchID uint) error {
func (s *BatchService) DeleteBatch(ctx context.Context, batchID string) error {
var batch model.FileBatch
if err := s.db.Preload("FileItems").First(&batch, batchID).Error; err != nil {
if err := s.db.Preload("FileItems").First(&batch, "id = ?", batchID).Error; err != nil {
return err
}
@@ -80,7 +80,7 @@ func (s *BatchService) DeleteBatch(ctx context.Context, batchID uint) error {
})
}
func (s *BatchService) IncrementDownloadCount(batchID uint) error {
func (s *BatchService) IncrementDownloadCount(batchID string) error {
return s.db.Model(&model.FileBatch{}).Where("id = ?", batchID).
UpdateColumn("download_count", gorm.Expr("download_count + ?", 1)).Error
}