sqlite的api,便于内部使用
liuxiaolong
2019-09-23 1152ed6c0dd453155ac71c87353d641d59c72a17
dbpersonApi.go
@@ -42,6 +42,27 @@
   return res.Success,res.Data
}
func (api DbPersonApi) UpdateFace(id string,faceFeature string, pic string) (bool,interface{}) {
   url := BASIC_URL + 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"
   client := NewClient()
@@ -129,11 +150,13 @@
   return persons,nil
}
func (api DbPersonApi) GetPersonTotal () (total int64,err error) {
func (api DbPersonApi) GetPersonTotal (tableId string) (total int64,err error) {
   url := BASIC_URL + DATA_URL_PREFIX + "/dbperson/getPersonTotal"
   client := NewClient()
   body,err := client.DoGetRequest(url, nil,nil)
   paramBody := map[string]string{
      "tableId": tableId,
   }
   body,err := client.DoGetRequest(url, paramBody,nil)
   if err != nil {
      return 0,err
   }
@@ -143,7 +166,7 @@
      return 0,err
   }
   return res.Data.(int64),nil
   return int64(res.Data.(float64)),nil
}
func (api DbPersonApi) GetPersonsCompareCacheBase (from int,size int) (persons []*protomsg.Esinfo,err error) {
@@ -163,12 +186,18 @@
      return nil,err
   }
   dataBytes, _ := json.Marshal(res.Data)
   var arr []protomsg.Esinfo
   if err = json.Unmarshal(dataBytes, &arr);err !=nil {
      return nil,err
   }
   for _,ei :=range arr {
      persons = append(persons,&ei)
      persons = append(persons,&protomsg.Esinfo{
         Id: ei.Id,
         Tableid: ei.Tableid,
         FaceFeature: ei.FaceFeature,
         Enable: ei.Enable,
      })
   }
   return persons,nil
}