zhaoqingang
2025-02-10 e0ac037f3d30e5fe50c884789eef97746a9e990f
models/locationAnalysis.go
@@ -285,8 +285,8 @@
func queryEsLocation(esClient *elasticsearch.Client, locationModel *LocationModel, documentNumbers []string) ([]*LocationRecord, error) {
   var buf bytes.Buffer
   nowTime := time.Now()
   startTime := nowTime.Add(-time.Duration(locationModel.Duration) * 24 * time.Hour)
   //nowTime := time.Now()
   //startTime := nowTime.Add(-time.Duration(locationModel.Duration) * 24 * time.Hour)
   // 构建过滤条件
   var filters []map[string]interface{}
@@ -328,28 +328,28 @@
      filters = append(filters, addrParams)
   }
   //var queryTimes []map[string]interface{}
   for date := startTime; date.Before(nowTime); date = date.Add(24 * time.Hour) {
      start := time.Date(date.Year(), date.Month(), date.Day(), locationModel.StartTime, 0, 0, 0, date.Location())
      end := time.Date(date.Year(), date.Month(), date.Day(), locationModel.EndTime, 0, 0, 0, date.Location())
      //queryTimes = append(queryTimes, map[string]interface{}{
      //   "range": map[string]interface{}{
      //      "picDate": map[string]interface{}{
      //         "gte": start.Format(time.DateTime), // "2006-01-02 15:04:05d"
      //         "lte": end.Format(time.DateTime),
      //      },
      //   },
      //})
      filters = append(filters, map[string]interface{}{
         "range": map[string]interface{}{
            "picDate": map[string]interface{}{
               "gte": start.Format(time.DateTime),
               "lte": end.Format(time.DateTime),
            },
         },
      })
   }
   //for date := startTime; date.Before(nowTime); date = date.Add(24 * time.Hour) {
   //   start := time.Date(date.Year(), date.Month(), date.Day(), locationModel.StartTime, 0, 0, 0, date.Location())
   //   end := time.Date(date.Year(), date.Month(), date.Day(), locationModel.EndTime, 0, 0, 0, date.Location())
   //
   //   //queryTimes = append(queryTimes, map[string]interface{}{
   //   //   "range": map[string]interface{}{
   //   //      "picDate": map[string]interface{}{
   //   //         "gte": start.Format(time.DateTime), // "2006-01-02 15:04:05d"
   //   //         "lte": end.Format(time.DateTime),
   //   //      },
   //   //   },
   //   //})
   //
   //   filters = append(filters, map[string]interface{}{
   //      "range": map[string]interface{}{
   //         "picDate": map[string]interface{}{
   //            "gte": start.Format(time.DateTime),
   //            "lte": end.Format(time.DateTime),
   //         },
   //      },
   //   })
   //}
   //filters = append(filters, map[string]interface{}{
   //   "bool": map[string]interface{}{
   //      "filter": queryTimes,