sunty
2020-09-02 4ec7b884fcec0f2566b1ee132955ac051c22f950
add all function outside sort
1个文件已修改
24 ■■■■ 已修改文件
EsApi.go 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
EsApi.go
@@ -257,20 +257,23 @@
    if err != nil {
        return nil, err
    }
    if len(source) == 0{
        return source,nil
    }
    faceSource := make([]map[string]interface{}, 0)
    for index, info := range source {
        if int(info["stayTime"].(float64)) > thresholdStayTime {
            faceSource = append(faceSource, source[index])
        }
    }
    mapsSort := MapsSort{}
    mapsSort.Key = "endTime"
    mapsSort.MapList = faceSource
    sort.Sort(&mapsSort)
    if len(faceSource) > total {
        mapsSort := MapsSort{}
        mapsSort.Key = "endTime"
        mapsSort.MapList = faceSource
        sort.Sort(&mapsSort)
        return mapsSort.MapList[:total], nil
    }
    return faceSource, nil
    return mapsSort.MapList, nil
}
func GetFaceDataByTimeAndId(startTime string, endTime string, id string, thresholdTime int, thresholdStayTime int, serverIp string, serverPort string, indexName string) (resData []map[string]interface{}, err error) {
@@ -355,13 +358,20 @@
    if err != nil {
        return nil, err
    }
    if len(source) == 0{
        return source,nil
    }
    faceSource := make([]map[string]interface{}, 0)
    for index, info := range source {
        if int(info["stayTime"].(float64)) > thresholdStayTime {
            faceSource = append(faceSource, source[index])
        }
    }
    return faceSource, nil
    mapsSort := MapsSort{}
    mapsSort.Key = "startTime"
    mapsSort.MapList = faceSource
    sort.Sort(&mapsSort)
    return mapsSort.MapList, nil
}
func GetFaceIdDeduplication(startTime string, endTime string, serverIp string, serverPort string, indexName string) (ids []map[string]interface{}, err error) {
@@ -434,7 +444,7 @@
    if err1 != nil {
        return nil, err1
    }
    if len(ids) > 0 {
    if len(ids) > 1 {
        mapsSort := MapsSort{}
        mapsSort.Key = "lastTime"
        mapsSort.MapList = ids