554325746@qq.com
2019-06-25 9dda95e194a0c947f1ad41dda7d916d4a0b2fb93
binfos struct to []byte
2个文件已修改
26 ■■■■■ 已修改文件
dbpersoninfo.go 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
esutil/EsClient.go 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
dbpersoninfo.go
@@ -54,7 +54,9 @@
//    Getdbpersonmsg("")
//}
func Getdbpersonmsg(teststring string, IsCompare bool) ([]protomsg.Baseinfo) {
func Getdbpersonmsg(teststring string, IsCompare bool) ([]byte) {
    var binfos protomsg.Binfos
    if !IsCompare {
        return nil
@@ -71,8 +73,15 @@
    firsttime := time.Now()
    Rscore := Cmap.Walk(Printest, teststring)
    binfos.Infos = append(binfos.Infos, Rscore...)
    binfosbytes, err := binfos.Marshal()
    if err != nil  {
        fmt.Println(err)
        return nil
    }
    fmt.Println(time.Since(firsttime))
    return Rscore
    return binfobytes
}
func Printest(ci, co string ) (float32){
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
}