sunty
2020-08-26 34c030a58af247ceb71205bc68a886a1f55dcc0b
fix stay time
2个文件已修改
14 ■■■■ 已修改文件
EsApi.go 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
EsClient.go 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
EsApi.go
@@ -296,7 +296,7 @@
                        }
                    }
                ],
                "size": 100000000
                "size": 100
            },
            "aggs":{
                "top_attention_hits":{
@@ -402,7 +402,7 @@
                        }
                    }
                ],
                "size": 100000000
                "size": 100
            },
            "aggs":{
                "top_attention_hits":{
EsClient.go
@@ -507,7 +507,10 @@
        middleHits := topAttentionHits["hits"].(map[string]interface{})
        finalHits := middleHits["hits"].([]interface{})
        startTime := ""
        indexLength := len(finalHits)
        point := 0
        for _, in := range finalHits {
            point = point+1
            tmpHitSource := make(map[string]interface{})
            tmpbuf, ok := in.(map[string]interface{})
            if !ok {
@@ -530,7 +533,7 @@
            sTime := tmpTime
            eTime := tmpTime
            stayTime := 0.0
            if startTime != "" {
            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)
@@ -624,8 +627,11 @@
        topAttentionHits := inf.(map[string]interface{})["top_attention_hits"].(map[string]interface{})
        middleHits := topAttentionHits["hits"].(map[string]interface{})
        finalHits := middleHits["hits"].([]interface{})
        indexLength := len(finalHits)
        point := 0
        startTime := ""
        for _, in := range finalHits {
            point = point+1
            tmpHitSource := make(map[string]interface{})
            tmpbuf, ok := in.(map[string]interface{})
            if !ok {
@@ -648,7 +654,7 @@
            sTime := tmpTime
            eTime := tmpTime
            stayTime := 0.0
            if startTime != "" {
            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)