From 9403e8b0eaa628a062d338244cfeb6f88ffe372d Mon Sep 17 00:00:00 2001 From: 554325746@qq.com <554325746@qq.com> Date: 星期一, 08 七月 2019 10:24:51 +0800 Subject: [PATCH] add if tableid== , range all --- esutil/EsClient.go | 46 ++++++++++++++++++++++++---------------------- 1 files changed, 24 insertions(+), 22 deletions(-) diff --git a/esutil/EsClient.go b/esutil/EsClient.go index 32eae09..212dbb9 100644 --- a/esutil/EsClient.go +++ b/esutil/EsClient.go @@ -12,36 +12,38 @@ "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 baseinfos []*protomsg.Baseinfo +func Parsesources(sources []map[string]interface{}) (esinfos []*protomsg.Esinfo) { var ok bool for _, source := range sources { - var tmpinfo protomsg.Baseinfo + var tmpinfo protomsg.Esinfo tmpinfo.FaceFeature, ok = source["faceFeature"].(string) Isnil("faceFeature", ok) - tmpinfo.PersonId, ok = source["id"].(string) + tmpinfo.Id, ok = source["id"].(string) Isnil("id", ok) - tmpinfo.TableId, ok = source["tableId"].(string) + tmpinfo.Tableid, ok = source["tableId"].(string) Isnil("tableId", ok) - tmpinfo.PersonName,ok = source["personName"].(string) - Isnil("personName", ok) - tmpinfo.PersonPicUrl,ok = source["personPicUrl"].(string) - Isnil("personPicUrl", ok) - tmpinfo.PhoneNum,ok = source["phoneNum"].(string) - Isnil("phoneNum", ok) - tmpinfo.Sex,ok = source["sex"].(string) - Isnil("sex", ok) - tmpinfo.Idcard,ok = source["idCard"].(string) - Isnil("idCard", ok) - tmpinfo.MonitorLevel,ok = source["monitorLevel"].(string) - baseinfos = append(baseinfos, &tmpinfo) + esinfos = append(esinfos, &tmpinfo) + +// tmpinfo.PersonName,ok = source["personName"].(string) +// Isnil("personName", ok) +// tmpinfo.PersonPicUrl,ok = source["personPicUrl"].(string) +// Isnil("personPicUrl", ok) +// tmpinfo.PhoneNum,ok = source["phoneNum"].(string) +// Isnil("phoneNum", ok) +// tmpinfo.Sex,ok = source["sex"].(string) +// Isnil("sex", ok) +// tmpinfo.Idcard,ok = source["idCard"].(string) +// Isnil("idCard", ok) +// tmpinfo.MonitorLevel,ok = source["monitorLevel"].(string) + + // 鏍规嵁 tableid 鑾峰彇 tablename +// name, _:= Dbtablename(tmpinfo.TableId) +// tmpinfo.TableName= name +// binfos.Infos = append(binfos.Infos, &tmpinfo) + } - return baseinfos + return } func Sourcelist(buf []byte)(sources []map[string]interface{}, err error){ -- Gitblit v1.8.0