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 |   53 ++++++++++++++++++++++++++---------------------------
 1 files changed, 26 insertions(+), 27 deletions(-)

diff --git a/esutil/EsClient.go b/esutil/EsClient.go
index d022703..212dbb9 100644
--- a/esutil/EsClient.go
+++ b/esutil/EsClient.go
@@ -8,41 +8,42 @@
 	"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{}) (esinfos []*protomsg.Esinfo) {
     var ok bool
     for _, source := range sources {
-
+       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){
@@ -93,13 +94,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