|
@@ -5,7 +5,6 @@ import (
|
|
|
"fmt"
|
|
|
"github.com/gogf/gf/v2/frame/g"
|
|
|
"github.com/gogf/gf/v2/net/gclient"
|
|
|
- "github.com/gogf/gf/v2/os/gtime"
|
|
|
"github.com/robfig/cron/v3"
|
|
|
"go.mongodb.org/mongo-driver/bson"
|
|
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
|
@@ -158,11 +157,25 @@ 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 {
|
|
|
+ getRes := make([]string, 0)
|
|
|
+ end := time.Date(2023, 12, 5, 0, 0, 0, 0, time.Local)
|
|
|
+ now := time.Now()
|
|
|
+ var recentDays []string
|
|
|
+ for i := 0; i < 15; i++ {
|
|
|
+ day := now.AddDate(0, 0, -i)
|
|
|
+ // 如果日期在 2023-12-05 及之后,则添加到 recentDays
|
|
|
+ if !day.Before(end) {
|
|
|
+ recentDays = append(recentDays, day.Format("2006-01-02"))
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, v := range recentDays {
|
|
|
+ res := gclient.New().GetContent(context.Background(), "http://172.17.145.164:18880/jyartvisit/"+v+".res")
|
|
|
+ arrs := strings.Split(res, "\n")
|
|
|
+ getRes = append(getRes, arrs...)
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, v := range getRes {
|
|
|
vs := strings.Split(v, " ")
|
|
|
if len(vs) == 2 {
|
|
|
insert := map[string]interface{}{
|