From 46cfcf793df15b7dd61881592e50931af49a8437 Mon Sep 17 00:00:00 2001
From: 554325746@qq.com <554325746@qq.com>
Date: 星期二, 25 六月 2019 16:25:02 +0800
Subject: [PATCH] binfos struct to []byte
---
esutil/EsClient.go | 15 ++++++---------
1 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/esutil/EsClient.go b/esutil/EsClient.go
index d022703..32eae09 100644
--- a/esutil/EsClient.go
+++ b/esutil/EsClient.go
@@ -8,21 +8,20 @@
"net/http"
"time"
"bytes"
-)
+ "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{}) []Baseinfo {
- var tmpinfo Baseinfo
- var baseinfos []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)
@@ -40,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
}
@@ -93,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
}
--
Gitblit v1.8.0