sunty
2020-08-26 859810ec55a27fe55b98ec7ea597f712802f47a8
EsClient.go
@@ -533,20 +533,23 @@
         sTime := tmpTime
         eTime := tmpTime
         stayTime := 0.0
         if startTime != "" && point < indexLength{
         if startTime != "" && point <= indexLength{
            sinTime, _ := time.ParseInLocation("2006-01-02 15:04:05", startTime, loc)
            passTime := math.Abs(mTime.Sub(sinTime).Seconds())
            //fmt.Println("passTime:   ", passTime)
            if passTime <= thresholdTime {
               startTime = tmpTime
               hitsSources[len(hitsSources)-1]["endTime"] = tmpTime
               if point == indexLength{
                  hitStartTime := hitsSources[len(hitsSources)-1]["startTime"].(string)
                  realStartTime, _ := time.ParseInLocation("2006-01-02 15:04:05", hitStartTime, loc)
                  stayTime = math.Abs(mTime.Sub(realStartTime).Seconds())
                  hitsSources[len(hitsSources)-1]["stayTime"] = stayTime
               }
               continue
            } else {
               hitStartTime := hitsSources[len(hitsSources)-1]["startTime"].(string)
               realStartTime, _ := time.ParseInLocation("2006-01-02 15:04:05", hitStartTime, loc)
               //fmt.Println("hitStartTime:    ",hitStartTime)
               //fmt.Println("realStartTime:    ",realStartTime)
               //fmt.Println("mTime:    ",mTime)
               stayTime = math.Abs(mTime.Sub(realStartTime).Seconds())
               //fmt.Println("stayTime:    ",stayTime)
               hitsSources[len(hitsSources)-1]["endTime"] = tmpTime
@@ -654,13 +657,19 @@
         sTime := tmpTime
         eTime := tmpTime
         stayTime := 0.0
         if startTime != "" && point < indexLength{
         if startTime != "" && point <= indexLength{
            sinTime, _ := time.ParseInLocation("2006-01-02 15:04:05", startTime, loc)
            passTime := math.Abs(mTime.Sub(sinTime).Seconds())
            //fmt.Println("passTime:   ", passTime)
            if passTime <= thresholdTime {
            if passTime <= thresholdTime || point == indexLength{
               startTime = tmpTime
               hitsSources[len(hitsSources)-1]["endTime"] = tmpTime
               if point == indexLength{
                  hitStartTime := hitsSources[len(hitsSources)-1]["startTime"].(string)
                  realStartTime, _ := time.ParseInLocation("2006-01-02 15:04:05", hitStartTime, loc)
                  stayTime = math.Abs(mTime.Sub(realStartTime).Seconds())
                  hitsSources[len(hitsSources)-1]["stayTime"] = stayTime
               }
               continue
            } else {
               hitStartTime := hitsSources[len(hitsSources)-1]["startTime"].(string)