package main import ( "context" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/gclient" "github.com/gogf/gf/v2/os/gtime" "log" "strings" ) func getHot() { file := gtime.Now().AddDate(0, 0, -1).Format("Y-m-d") res := gclient.New().GetContent(context.Background(), "http://172.17.145.164:18880/jyartvisit/"+file+".res") //res := gclient.New().GetContent(context.Background(), "http://127.0.0.1:50080/jyartvisit/"+file+".res") arrs := strings.Split(res, "\n") for _, v := range arrs { vs := strings.Split(v, " ") if len(vs) == 2 { log.Println("id:", vs[0], "值:", g.NewVar(vs[1]).Int()) } } }