| | |
| | | ) |
| | | |
| | | type DbPersonApi struct { |
| | | Ip string |
| | | Port int |
| | | } |
| | | |
| | | func (api DbPersonApi) getBasicUrl() string { |
| | | if api.Ip == "" { |
| | | return BASIC_URL |
| | | } |
| | | if api.Ip == "" { |
| | | api.Ip = DEFAULT_IP |
| | | } |
| | | if api.Port == 0 { |
| | | api.Port = DEFAULT_PORT |
| | | } |
| | | return "http://"+api.Ip+":"+strconv.Itoa(api.Port) |
| | | } |
| | | |
| | | func (api DbPersonApi) QueryDbPersonsByTbId(paramBody map[string]interface{}) (bool,interface{}) { |
| | | url := BASIC_URL + DATA_URL_PREFIX + "/dbperson/queryDbPersonsByTbId" |
| | | url := api.getBasicUrl() + DATA_URL_PREFIX + "/dbperson/queryDbPersonsByTbId" |
| | | client := NewClient() |
| | | body,err := client.DoPostRequest(url,CONTENT_TYPE_JSON, paramBody,nil,nil) |
| | | if err != nil { |
| | |
| | | } |
| | | |
| | | func (api DbPersonApi) UpdateDbPerson(paramBody map[string]interface{}) (bool,interface{}) { |
| | | url := BASIC_URL + DATA_URL_PREFIX + "/dbperson/updateDbPerson" |
| | | url := api.getBasicUrl() + DATA_URL_PREFIX + "/dbperson/updateDbPerson" |
| | | client := NewClient() |
| | | body,err := client.DoPostRequest(url,CONTENT_TYPE_JSON, paramBody,nil,nil) |
| | | if err != nil { |
| | |
| | | return res.Success,res.Data |
| | | } |
| | | |
| | | func (api DbPersonApi) UpdateFace(id string,faceFeature string, pic string) (bool,interface{}) { |
| | | url := api.getBasicUrl() + DATA_URL_PREFIX + "/dbperson/updateFace" |
| | | client := NewClient() |
| | | paramBody := map[string]interface{}{ |
| | | "id": id, |
| | | "faceFeature": faceFeature, |
| | | "personPicUrl": pic, |
| | | } |
| | | body,err := client.DoPostRequest(url,CONTENT_TYPE_JSON, paramBody,nil,nil) |
| | | if err != nil { |
| | | return false,nil |
| | | } |
| | | |
| | | var res Result |
| | | if err = json.Unmarshal(body, &res); err != nil { |
| | | return false,nil |
| | | } |
| | | |
| | | return res.Success,res.Data |
| | | } |
| | | |
| | | func (api DbPersonApi) AddDbPerson(paramBody map[string]interface{}) (bool,interface{}) { |
| | | url := BASIC_URL + DATA_URL_PREFIX + "/dbperson/addDbPerson" |
| | | url := api.getBasicUrl() + DATA_URL_PREFIX + "/dbperson/addDbPerson" |
| | | client := NewClient() |
| | | body,err := client.DoPutRequest(url,CONTENT_TYPE_JSON, paramBody,nil) |
| | | if err != nil { |
| | |
| | | } |
| | | |
| | | func (api DbPersonApi) DeleteDbPerson(id string) (bool,interface{}) { |
| | | url := BASIC_URL + DATA_URL_PREFIX + "/dbperson/deleteDbPersonById/"+id |
| | | url := api.getBasicUrl() + DATA_URL_PREFIX + "/dbperson/deleteDbPersonById/"+id |
| | | client := NewClient() |
| | | body,err := client.DoPostRequest(url,CONTENT_TYPE_JSON, nil,nil,nil) |
| | | if err != nil { |
| | |
| | | } |
| | | |
| | | func (api DbPersonApi) DeleteMoreDbPerson(paramBody map[string]interface{}) (bool,interface{}) { |
| | | url := BASIC_URL + DATA_URL_PREFIX + "/dbperson/deleteMoreDbPerson" |
| | | url := api.getBasicUrl() + DATA_URL_PREFIX + "/dbperson/deleteMoreDbPerson" |
| | | client := NewClient() |
| | | body,err := client.DoPostRequest(url,CONTENT_TYPE_JSON, paramBody,nil,nil) |
| | | if err != nil { |
| | |
| | | } |
| | | |
| | | func (api DbPersonApi) DeletePersonsByTbId(tableId string) (bool,interface{}) { |
| | | url := BASIC_URL + DATA_URL_PREFIX + "/dbperson/deletePersonsByTbId/"+tableId |
| | | url := api.getBasicUrl() + DATA_URL_PREFIX + "/dbperson/deletePersonsByTbId/"+tableId |
| | | client := NewClient() |
| | | body,err := client.DoPostRequest(url,CONTENT_TYPE_JSON, nil,nil,nil) |
| | | if err != nil { |
| | |
| | | |
| | | //根据底库人员id查询人员信息详情 |
| | | func (api DbPersonApi) Dbpersoninfosbyid (ids []string) (persons []protomsg.Dbperson,err error) { |
| | | url := BASIC_URL + DATA_URL_PREFIX + "/dbperson/dbPersonInfoByIds" |
| | | url := api.getBasicUrl() + DATA_URL_PREFIX + "/dbperson/dbPersonInfoByIds" |
| | | client := NewClient() |
| | | paramBody := map[string]interface{}{ |
| | | "ids": ids, |
| | |
| | | } |
| | | |
| | | func (api DbPersonApi) GetPersonTotal (tableId string) (total int64,err error) { |
| | | url := BASIC_URL + DATA_URL_PREFIX + "/dbperson/getPersonTotal" |
| | | url := api.getBasicUrl() + DATA_URL_PREFIX + "/dbperson/getPersonTotal" |
| | | client := NewClient() |
| | | paramBody := map[string]string{ |
| | | "tableId": tableId, |
| | |
| | | } |
| | | |
| | | func (api DbPersonApi) GetPersonsCompareCacheBase (from int,size int) (persons []*protomsg.Esinfo,err error) { |
| | | url := BASIC_URL + DATA_URL_PREFIX + "/dbperson/getPersonsCompareCacheBase" |
| | | url := api.getBasicUrl() + DATA_URL_PREFIX + "/dbperson/getPersonsCompareCacheBase" |
| | | client := NewClient() |
| | | paramBody := map[string]string{ |
| | | "from": strconv.Itoa(from), |