554325746@qq.com
2019-07-08 d25f504c5fabb9eadb77c38f0df3cda983495be1
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!")