From 78e8d18b24c3e04291083dd896ff360396a35f9e Mon Sep 17 00:00:00 2001 From: kercylan98 Date: Wed, 17 May 2023 18:56:15 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=AF=BC=E5=87=BA=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- planner/configexport/internal/export.go | 46 ------------------- planner/configexport/internal/export_go.go | 1 - .../configexport/internal/internal/defines.go | 22 --------- 3 files changed, 69 deletions(-) delete mode 100644 planner/configexport/internal/export.go delete mode 100644 planner/configexport/internal/export_go.go delete mode 100644 planner/configexport/internal/internal/defines.go diff --git a/planner/configexport/internal/export.go b/planner/configexport/internal/export.go deleted file mode 100644 index 008ab8d..0000000 --- a/planner/configexport/internal/export.go +++ /dev/null @@ -1,46 +0,0 @@ -package internal - -import ( - "fmt" - "github.com/kercylan98/minotaur/utils/file" - "github.com/kercylan98/minotaur/utils/log" - "github.com/tealeg/xlsx" - "go.uber.org/zap" - "path/filepath" - "runtime/debug" - "sync" -) - -func ExportJSON(xlsxPath string, output string) { - xlsxFile, err := xlsx.OpenFile(xlsxPath) - if err != nil { - panic(err) - } - var errors []func() - var wait sync.WaitGroup - for _, sheet := range xlsxFile.Sheets { - sheet := sheet - go func() { - defer func() { - if err := recover(); err != nil { - errors = append(errors, func() { - log.Error("导出失败", zap.String("名称", xlsxPath), zap.String("Sheet", sheet.Name), zap.Any("err", err)) - fmt.Println(debug.Stack()) - }) - } - }() - wait.Add(1) - config := NewConfig(sheet) - if err := file.WriterFile(filepath.Join(output, fmt.Sprintf("%s.json", config.GetName())), config.GetJSON()); err != nil { - panic(err) - } - wait.Done() - }() - } - - wait.Wait() - - for _, f := range errors { - f() - } -} diff --git a/planner/configexport/internal/export_go.go b/planner/configexport/internal/export_go.go deleted file mode 100644 index 5bf0569..0000000 --- a/planner/configexport/internal/export_go.go +++ /dev/null @@ -1 +0,0 @@ -package internal diff --git a/planner/configexport/internal/internal/defines.go b/planner/configexport/internal/internal/defines.go deleted file mode 100644 index 5db08d7..0000000 --- a/planner/configexport/internal/internal/defines.go +++ /dev/null @@ -1,22 +0,0 @@ -package internal - -type XXConfig struct { - Id int - Count string - Award map[int]string - Info *struct { - Id int - Name string - Info *struct { - Lv int - Exp *struct { - Mux int - Count int - } - } - } - Other *struct { - Id int - Name string - } -}