updateBatchStatus 更新批次状态
(batch *BatchUpload)
| 403 | |
| 404 | // updateBatchStatus 更新批次状态 |
| 405 | func (m *BatchUploadManager) updateBatchStatus(batch *BatchUpload) { |
| 406 | if batch == nil { |
| 407 | return |
| 408 | } |
| 409 | m.mu.Lock() |
| 410 | if batch.Status != "cancelled" { |
| 411 | if batch.UploadedFiles+batch.FailedFiles >= batch.TotalFiles { |
| 412 | if batch.FailedFiles == 0 { |
| 413 | batch.Status = "completed" |
| 414 | } else { |
| 415 | batch.Status = "failed" |
| 416 | } |
| 417 | } else { |
| 418 | batch.Status = "uploading" |
| 419 | } |
| 420 | } |
| 421 | batch.UpdatedAt = time.Now() |
| 422 | m.mu.Unlock() |
| 423 | |
| 424 | m.progressStorage.SaveBatch(batch) |
| 425 | } |
| 426 | |
| 427 | // CancelBatch 取消批量上传 |
| 428 | func (m *BatchUploadManager) CancelBatch(batchID string) error { |
no test coverage detected