hot_data.go 627 B

123456789101112131415161718192021222324
  1. package main
  2. import (
  3. "context"
  4. "github.com/gogf/gf/v2/frame/g"
  5. "github.com/gogf/gf/v2/net/gclient"
  6. "github.com/gogf/gf/v2/os/gtime"
  7. "log"
  8. "strings"
  9. )
  10. func getHot() {
  11. file := gtime.Now().AddDate(0, 0, -1).Format("Y-m-d")
  12. res := gclient.New().GetContent(context.Background(), "http://172.17.145.164:18880/jyartvisit/"+file+".res")
  13. //res := gclient.New().GetContent(context.Background(), "http://127.0.0.1:50080/jyartvisit/"+file+".res")
  14. arrs := strings.Split(res, "\n")
  15. for _, v := range arrs {
  16. vs := strings.Split(v, " ")
  17. if len(vs) == 2 {
  18. log.Println("id:", vs[0], "值:", g.NewVar(vs[1]).Int())
  19. }
  20. }
  21. }