| | |
| | | "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) |
| | | 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 |
| | | baseinfos = append(baseinfos, &tmpinfo) |
| | | // 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){ |