554325746@qq.com
2019-06-25 9dda95e194a0c947f1ad41dda7d916d4a0b2fb93
esutil/EsClient.go
@@ -12,19 +12,16 @@
    "basic.com/pubsub/protomsg.git"
)
func GetDbinfo(dbinforequest string)([]byte, error) {
    buf , err := EsReq("POST", "http://192.168.1.182:9200/dbtablepersons/dbpersons/_search", []byte(dbinforequest))
    return buf, err
}
func Parsesources(sources []map[string]interface{}) []protomsg.Baseinfo {
    var tmpinfo protomsg.Baseinfo
    var baseinfos []protomsg.Baseinfo
func Parsesources(sources []map[string]interface{}) []*protomsg.Baseinfo {
    var baseinfos []*protomsg.Baseinfo
    var ok bool
    for _, source := range sources {
        var tmpinfo protomsg.Baseinfo
        tmpinfo.FaceFeature, ok =   source["faceFeature"].(string)
            Isnil("faceFeature", ok)
        tmpinfo.PersonId, ok    =   source["id"].(string)  
@@ -42,7 +39,7 @@
        tmpinfo.Idcard,ok       =  source["idCard"].(string)
            Isnil("idCard", ok)
        tmpinfo.MonitorLevel,ok =  source["monitorLevel"].(string)
        baseinfos = append(baseinfos, tmpinfo)
        baseinfos = append(baseinfos, &tmpinfo)
    }
    return baseinfos
}
@@ -95,13 +92,11 @@
    }
    defer resp.Body.Close()
    body, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        fmt.Println(err) 
        return nil , err
    }
    return body, nil
}