Roc 2 年之前
父节点
当前提交
5470980e39
共有 3 个文件被更改,包括 9 次插入1 次删除
  1. 2 1
      services/api_tool.go
  2. 2 0
      services/index.go
  3. 5 0
      services/index_queue.go

+ 2 - 1
services/api_tool.go

@@ -3,6 +3,7 @@ package services
 import (
 	"fmt"
 	"github.com/rdlucklib/rdluck_tools/http"
+	"net/url"
 )
 
 const (
@@ -12,7 +13,7 @@ const (
 func MysteelChemicalRefresh(filePath string) {
 	var refreshUrl string
 	//filePathStr:=url.PathEscape(filePath)
-	refreshUrl = RefreshUrl + "?FilePath=" + filePath
+	refreshUrl = RefreshUrl + "?FilePath=" + url.QueryEscape(filePath)
 	fmt.Println("MysteelChemicalRefresh URL:"+refreshUrl)
 	body, err := http.Get(refreshUrl)
 	if err != nil {

+ 2 - 0
services/index.go

@@ -91,6 +91,8 @@ func IndexCreate(item *index.BaseFromMysteelChemicalIndex) (saveFilePath string,
 	}
 	filePath := utils.IndexSaveDir + fileName
 	if utils.FileIsExist(filePath) {
+		saveFilePath = filePath
+		return
 		os.Remove(filePath)
 	}
 	templatePath := utils.IndexSaveDir + "index_template.xlsx"

+ 5 - 0
services/index_queue.go

@@ -4,6 +4,7 @@ import (
 	"fmt"
 	"hongze/mysteel_watch/global"
 	"hongze/mysteel_watch/utils"
+	"strings"
 	"time"
 )
 
@@ -27,6 +28,10 @@ func IndexHandle(filePath string) {
 	//if err != nil {
 	//	go alarm_msg.SendAlarmMsg(utils.APPNAME+" 指标数据未生成检测失败:"+err.Error()+";file:"+filePath, 3)
 	//}
+	filePath = strings.Replace(filePath,`"`,``,-1)
+	fmt.Println("开始刷新文件:",filePath)
 	time.Sleep(1 * time.Second)
 	MysteelChemicalRefresh(filePath)
+	//刷新完成后,清除缓存
+	//global.Rc.Delete(filePath)
 }