From d25f504c5fabb9eadb77c38f0df3cda983495be1 Mon Sep 17 00:00:00 2001
From: 554325746@qq.com <554325746@qq.com>
Date: 星期一, 08 七月 2019 15:40:39 +0800
Subject: [PATCH] add query dbperson info by id

---
 esutil/EsClient.go |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/esutil/EsClient.go b/esutil/EsClient.go
index 212dbb9..53a5072 100644
--- a/esutil/EsClient.go
+++ b/esutil/EsClient.go
@@ -46,6 +46,38 @@
     return
 }
 
+func Dbpersonbyid(sources []map[string]interface{}) (protomsg.Baseinfo) {
+        var ok bool
+        
+        var tmpinfo protomsg.Baseinfo
+        for _, source := range  sources{
+            tmpinfo.FaceFeature, ok =   source["faceFeature"].(string)
+                Isnil("faceFeature", ok)
+            tmpinfo.PersonId, ok    =   source["id"].(string)  
+                Isnil("id", ok)
+            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)
+
+            //鏍规嵁 tableid 鑾峰彇 tablename
+            name, _:= Dbtablename(tmpinfo.TableId) 
+            tmpinfo.TableName= name 
+        }
+
+        return tmpinfo 
+}
+
 func Sourcelist(buf []byte)(sources []map[string]interface{}, err error){
     var info interface{}
     json.Unmarshal(buf, &info)
@@ -53,6 +85,7 @@
     if !ok {
         return nil, errors.New("http response interface can not change map[string]interface{}")
     }
+
     middle, ok := out["hits"].(map[string]interface{})
     if !ok {
         return nil, errors.New("first hits change error!")

--
Gitblit v1.8.0