sqlite的api,便于内部使用
liuxiaolong
2020-03-06 f84398d56141593e698e438f53812ae0b13141f4
dbpersonApi.go
@@ -183,7 +183,7 @@
   return int64(res.Data.(float64)),nil
}
func (api DbPersonApi) GetPersonsCompareCacheBase (from int,size int) (persons []*protomsg.Esinfo,err error) {
func (api DbPersonApi) GetPersonsCompareCacheBase (from int,size int) (persons []*protomsg.PersonCar,err error) {
   url := api.getBasicUrl() + DATA_URL_PREFIX + "/dbperson/getPersonsCompareCacheBase"
   client := NewClient()
   paramBody := map[string]string{
@@ -201,22 +201,24 @@
   }
   dataBytes, _ := json.Marshal(res.Data)
   var arr []protomsg.Esinfo
   var arr []protomsg.PersonCar
   if err = json.Unmarshal(dataBytes, &arr);err !=nil {
      return nil,err
   }
   for _,ei :=range arr {
      persons = append(persons,&protomsg.Esinfo{
      persons = append(persons,&protomsg.PersonCar{
         Id: ei.Id,
         Tableid: ei.Tableid,
         FaceFeature: ei.FaceFeature,
         Enable: ei.Enable,
         CarNo: ei.CarNo,
      })
   }
   return persons,nil
}
func (api DbPersonApi) FindLikePersonIds (tableIds  []string,inputValue string) (personIds []string,err error) {
func (api DbPersonApi) FindLikePersonIds (tableIds  []string,inputValue string) (interface{},error) {
   url := api.getBasicUrl() + DATA_URL_PREFIX + "/dbperson/findLikePersonIds"
   client := NewClient()
   paramBody := map[string]interface{}{
@@ -232,9 +234,63 @@
   if err = json.Unmarshal(body, &res); err != nil {
      return nil,err
   }
   dataBytes, _ := json.Marshal(res.Data)
   if err = json.Unmarshal(dataBytes, &personIds);err !=nil {
      return nil,err
   return res.Data,nil
}
func (api DbPersonApi) JoinDbTable (tableIds  []string,faceFeature string, personPicUrl string) (bool,interface{}) {
   url := api.getBasicUrl() + DATA_URL_PREFIX + "/dbperson/joinDbTable"
   client := NewClient()
   paramBody := map[string]interface{}{
      "tableIds": tableIds,
      "faceFeature": faceFeature,
      "personPicUrl": personPicUrl,
   }
   return personIds,nil
   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) Move (personId string,tableIds []string) (bool,interface{}) {
   url := api.getBasicUrl() + DATA_URL_PREFIX + "/dbperson/move"
   client := NewClient()
   paramBody := map[string]interface{}{
      "personId": personId,
      "tableIds": tableIds,
   }
   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) Copy (personId string,tableIds []string) (bool,interface{}) {
   url := api.getBasicUrl() + DATA_URL_PREFIX + "/dbperson/copy"
   client := NewClient()
   paramBody := map[string]interface{}{
      "personId": personId,
      "tableIds": tableIds,
   }
   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
}