Browse Source

修复 hot_fix_001.go 返回 nil 可能导致故障的问题 fix #214

Signed-off-by: allan716 <[email protected]>
allan716 3 years ago
parent
commit
c32a6541f8
1 changed files with 11 additions and 11 deletions
  1. 11 11
      internal/pkg/hot_fix/hot_fix_001.go

+ 11 - 11
internal/pkg/hot_fix/hot_fix_001.go

@@ -40,7 +40,7 @@ func (h HotFix001) Process() (interface{}, error) {
 	return h.process()
 }
 
-func (h HotFix001) process() (interface{}, error) {
+func (h HotFix001) process() (OutStruct001, error) {
 
 	outStruct := OutStruct001{}
 	outStruct.RenamedFiles = make([]string, 0)
@@ -50,12 +50,12 @@ func (h HotFix001) process() (interface{}, error) {
 		log_helper.GetLogger().Infoln("Fix Movie Dir Index", i, dir, "Start...")
 		fixMovie, err := h.fixMovie(dir)
 		if err != nil {
-			log_helper.GetLogger().Infoln("Fix Movie Dir Index", i, dir, "End...")
-			return nil, err
+			log_helper.GetLogger().Errorln("Fix Movie Dir Index", i, dir, "End With Error", err)
+			return outStruct, err
 		}
 
-		outStruct.RenamedFiles = append(outStruct.RenamedFiles, fixMovie.(OutStruct001).RenamedFiles...)
-		outStruct.ErrFiles = append(outStruct.ErrFiles, fixMovie.(OutStruct001).ErrFiles...)
+		outStruct.RenamedFiles = append(outStruct.RenamedFiles, fixMovie.RenamedFiles...)
+		outStruct.ErrFiles = append(outStruct.ErrFiles, fixMovie.ErrFiles...)
 
 		log_helper.GetLogger().Infoln("Fix Movie Dir Index", i, dir, "End...")
 	}
@@ -64,12 +64,12 @@ func (h HotFix001) process() (interface{}, error) {
 		log_helper.GetLogger().Infoln("Fix Series Dir Index", i, dir, "Start...")
 		fixSeries, err := h.fixSeries(dir)
 		if err != nil {
-			log_helper.GetLogger().Infoln("Fix Series Dir Index", i, dir, "End...")
-			return nil, err
+			log_helper.GetLogger().Errorln("Fix Series Dir Index", i, dir, "End With Error", err)
+			return outStruct, err
 		}
 
-		outStruct.RenamedFiles = append(outStruct.RenamedFiles, fixSeries.(OutStruct001).RenamedFiles...)
-		outStruct.ErrFiles = append(outStruct.ErrFiles, fixSeries.(OutStruct001).ErrFiles...)
+		outStruct.RenamedFiles = append(outStruct.RenamedFiles, fixSeries.RenamedFiles...)
+		outStruct.ErrFiles = append(outStruct.ErrFiles, fixSeries.ErrFiles...)
 
 		log_helper.GetLogger().Infoln("Fix Series Dir Index", i, dir, "End...")
 	}
@@ -77,7 +77,7 @@ func (h HotFix001) process() (interface{}, error) {
 	return outStruct, nil
 }
 
-func (h HotFix001) fixMovie(movieRootDir string) (interface{}, error) {
+func (h HotFix001) fixMovie(movieRootDir string) (OutStruct001, error) {
 
 	var err error
 	outStruct := OutStruct001{}
@@ -117,7 +117,7 @@ func (h HotFix001) fixMovie(movieRootDir string) (interface{}, error) {
 	return outStruct, nil
 }
 
-func (h HotFix001) fixSeries(seriesRootDir string) (interface{}, error) {
+func (h HotFix001) fixSeries(seriesRootDir string) (OutStruct001, error) {
 	var err error
 	outStruct := OutStruct001{}
 	outStruct.RenamedFiles = make([]string, 0)