api_tool.go 948 B

123456789101112131415161718192021222324252627282930
  1. package services
  2. import (
  3. "fmt"
  4. "github.com/rdlucklib/rdluck_tools/http"
  5. "hongze/hongtao3_watch/global"
  6. "net/url"
  7. )
  8. const (
  9. // RefreshUrl 值示例:http://127.0.0.1:7007/hongtao/refresh?FilePath=E:\hz\hongtao3_data\excel\Oneline\%E7%83%A7%E7%A2%B1.xlsx
  10. DefaultRefreshUrl = "http://127.0.0.1:7007/"
  11. )
  12. // InvokeRefreshServer 调用红桃3刷新数据的服务(目前是python)
  13. func InvokeRefreshServer(filePath string) {
  14. var refreshUrl string
  15. if global.CONFIG.Serve.RefreshUrl == "" {
  16. refreshUrl = DefaultRefreshUrl
  17. }
  18. //filePathStr:=url.PathEscape(filePath)
  19. refreshUrl = refreshUrl + "hongtao/refresh?FilePath=" + url.QueryEscape(filePath)
  20. fmt.Println("红桃3刷新,文件路径:", filePath, ";刷新URL:"+refreshUrl)
  21. body, err := http.Get(refreshUrl)
  22. if err != nil {
  23. fmt.Println("红桃3刷新 Err:" + err.Error())
  24. return
  25. }
  26. fmt.Println("红桃3刷新,文件路径:", filePath, " ,Result:"+string(body))
  27. }