api_tool.go 993 B

12345678910111213141516171819202122232425262728293031
  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. refreshUrl = global.CONFIG.Serve.RefreshUrl
  16. if global.CONFIG.Serve.RefreshUrl == "" {
  17. refreshUrl = DefaultRefreshUrl
  18. }
  19. //filePathStr:=url.PathEscape(filePath)
  20. refreshUrl = refreshUrl + "hongtao/refresh?FilePath=" + url.QueryEscape(filePath)
  21. fmt.Println("红桃3刷新,文件路径:", filePath, ";刷新URL:"+refreshUrl)
  22. body, err := http.Get(refreshUrl)
  23. if err != nil {
  24. fmt.Println("红桃3刷新 Err:" + err.Error())
  25. return
  26. }
  27. fmt.Println("红桃3刷新,文件路径:", filePath, " ,Result:"+string(body))
  28. }