|
@@ -6,7 +6,11 @@ import (
|
|
|
"eta/eta_data_analysis/services/kpler"
|
|
|
"eta/eta_data_analysis/utils"
|
|
|
"fmt"
|
|
|
+ "io/fs"
|
|
|
+ "os"
|
|
|
+ "path/filepath"
|
|
|
"strings"
|
|
|
+ "syscall"
|
|
|
"time"
|
|
|
|
|
|
"github.com/patrickmn/go-cache"
|
|
@@ -26,7 +30,7 @@ func ExcelDataWatch() {
|
|
|
if cacheClient == nil {
|
|
|
cacheClient = cache.New(365*24*time.Hour, 365*24*time.Hour)
|
|
|
}
|
|
|
- /*err = filepath.Walk(utils.KplerExcelFilePath, func(path string, info fs.FileInfo, err error) error {
|
|
|
+ err = filepath.Walk(utils.KplerExcelFilePath, func(path string, info fs.FileInfo, err error) error {
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
@@ -45,20 +49,20 @@ func ExcelDataWatch() {
|
|
|
if ok {
|
|
|
existModifyTimeStr := existModifyTime.(string)
|
|
|
if existModifyTimeStr != modifyTimeStr {
|
|
|
- _, err = GetKplerDataByExcel(path)
|
|
|
+ err = GetKplerDataByExcel(path)
|
|
|
}
|
|
|
} else {
|
|
|
- _, err = GetKplerDataByExcel(path)
|
|
|
+ err = GetKplerDataByExcel(path)
|
|
|
}
|
|
|
cacheClient.Delete(path)
|
|
|
cacheClient.Set(path, modifyTimeStr, 24*time.Hour)
|
|
|
}
|
|
|
return nil
|
|
|
- })*/
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
// Main function for standalone testing
|
|
|
-func GetKplerDataByExcel(filePath string) {
|
|
|
+func GetKplerDataByExcel(filePath string) (err error) {
|
|
|
filePath = "services/kpler/crude.xlsx"
|
|
|
fmt.Println("Starting Kpler data processing...")
|
|
|
|
|
@@ -156,6 +160,7 @@ func GetKplerDataByExcel(filePath string) {
|
|
|
// 传递list给指标服务
|
|
|
|
|
|
fmt.Println("GetKplerDataByExcel completed successfully!")
|
|
|
+ return
|
|
|
}
|
|
|
|
|
|
|