| | |
| | | topAttentionHits := inf.(map[string]interface{})["top_attention_hits"].(map[string]interface{}) |
| | | middleHits := topAttentionHits["hits"].(map[string]interface{}) |
| | | finalHits := middleHits["hits"].([]interface{}) |
| | | tmpHitSource := make(map[string]interface{}) |
| | | startTime := "" |
| | | for _, in := range finalHits { |
| | | tmpHitSource := make(map[string]interface{}) |
| | | tmpbuf, ok := in.(map[string]interface{}) |
| | | if !ok { |
| | | fmt.Println("change to source error!") |
| | |
| | | stayTime := 0.0 |
| | | if startTime != "" { |
| | | sinTime, _ := time.ParseInLocation("2006-01-02 15:04:05", startTime, loc) |
| | | stayTime = math.Abs(sinTime.Sub(mTime).Seconds()) |
| | | if stayTime <= thresholdTime { |
| | | passTime := math.Abs(mTime.Sub(sinTime).Seconds()) |
| | | //fmt.Println("passTime: ", passTime) |
| | | if passTime <= thresholdTime { |
| | | startTime = tmpTime |
| | | hitsSources[len(hitsSources)-1]["endTime"] = tmpTime |
| | | 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 |
| | | //fmt.Println("stayTime",stayTime) |
| | | if sinTime.Sub(mTime).Seconds() == 0 { |
| | | sinTime.Add(time.Second * 1) |
| | | sinTime.Format("2006-01-02 15:04:05") |
| | | hitsSources[len(hitsSources)-1]["endTime"] = sinTime |
| | | hitsSources[len(hitsSources)-1]["endTime"] = tmpTime |
| | | stayTime = stayTime + 1 |
| | | } |
| | | hitsSources[len(hitsSources)-1]["stayTime"] = stayTime |
| | | //fmt.Println(hitsSources[len(hitsSources)-1]) |
| | | } |
| | | } |
| | | //fmt.Println("========================================================") |
| | | startTime = tmpTime |
| | | tmpHitSource["personId"] = baseInfo["targetId"].(string) |
| | | tmpHitSource["cameraId"] = source["cameraId"].(string) |
| | |
| | | tmpHitSource["endTBackGroundPicUrl"] = source["picMaxUrl"].([]interface{}) |
| | | tmpHitSource["endTFacePicUrl"] = targetInfo["picSmUrl"].(string) |
| | | if source["picWH"] != nil { |
| | | tmpHitSource["picWH"] = source["picWH"].(map[string]interface{}) |
| | | tmpHitSource["picWH"] = source["picWH"].(map[string]interface{}) |
| | | } |
| | | hitsSources = append(hitsSources, tmpHitSource) |
| | | } |
| | |
| | | topAttentionHits := inf.(map[string]interface{})["top_attention_hits"].(map[string]interface{}) |
| | | middleHits := topAttentionHits["hits"].(map[string]interface{}) |
| | | finalHits := middleHits["hits"].([]interface{}) |
| | | tmpHitSource := make(map[string]interface{}) |
| | | startTime := "" |
| | | for _, in := range finalHits { |
| | | tmpHitSource := make(map[string]interface{}) |
| | | tmpbuf, ok := in.(map[string]interface{}) |
| | | if !ok { |
| | | fmt.Println("change to source error!") |
| | |
| | | stayTime := 0.0 |
| | | if startTime != "" { |
| | | sinTime, _ := time.ParseInLocation("2006-01-02 15:04:05", startTime, loc) |
| | | stayTime = math.Abs(sinTime.Sub(mTime).Seconds()) |
| | | if stayTime <= thresholdTime { |
| | | passTime := math.Abs(mTime.Sub(sinTime).Seconds()) |
| | | //fmt.Println("passTime: ", passTime) |
| | | if passTime <= thresholdTime { |
| | | startTime = tmpTime |
| | | hitsSources[len(hitsSources)-1]["endTime"] = tmpTime |
| | | 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 |
| | | //fmt.Println("stayTime",stayTime) |
| | | if sinTime.Sub(mTime).Seconds() == 0 { |
| | | sinTime.Add(time.Second * 1) |
| | | sinTime.Format("2006-01-02 15:04:05") |
| | | hitsSources[len(hitsSources)-1]["endTime"] = sinTime |
| | | hitsSources[len(hitsSources)-1]["endTime"] = tmpTime |
| | | stayTime = stayTime + 1 |
| | | } |
| | | hitsSources[len(hitsSources)-1]["stayTime"] = stayTime |
| | | //fmt.Println(hitsSources[len(hitsSources)-1]) |
| | | } |
| | | } |
| | | startTime = tmpTime |
| | |
| | | } |
| | | hitsSources = append(hitsSources, tmpHitSource) |
| | | } |
| | | tmpSources["groupKey"] = groupKey |
| | | tmpSources["hits_sources"] = hitsSources |
| | | sources = append(sources, tmpSources) |
| | | tmpSources["groupKey"] = groupKey |
| | | tmpSources["hits_sources"] = hitsSources |
| | | sources = append(sources, tmpSources) |
| | | } |
| | | return sources, nil |
| | | } |