feat: 移动文件完成后清空 scan_log 续传记录
This commit is contained in:
@@ -360,6 +360,11 @@ func (s *ScanService) runMove(ctx context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// 移动完成后清空续传记录
|
||||
if err := s.store.ClearScanLog(); err != nil {
|
||||
fmt.Printf("=== 清空续传记录失败: %v\n", err)
|
||||
}
|
||||
|
||||
fmt.Println("=== 文件移动完成")
|
||||
s.finish(ScanDone, fmt.Sprintf("文件移动完成,共移动 %d 个文件", len(jobs)))
|
||||
}
|
||||
|
||||
@@ -189,6 +189,15 @@ func (s *Store) SaveScanLogs(entries []ScanLog) error {
|
||||
return sess.Commit()
|
||||
}
|
||||
|
||||
// ClearScanLog 清空全部续传记录。移动完成后调用。
|
||||
func (s *Store) ClearScanLog() error {
|
||||
if s == nil || s.engine == nil {
|
||||
return nil
|
||||
}
|
||||
_, err := s.engine.Delete(new(ScanLog))
|
||||
return err
|
||||
}
|
||||
|
||||
// ============================ 媒体记录的新增/更新 ============================
|
||||
|
||||
// SaveMedia 保存/更新一条媒体记录:按 MD5 找,有就更新,没有就新增。
|
||||
|
||||
Reference in New Issue
Block a user