| | |
| | | if dbperson.TableId == "" { |
| | | // 底库id不存在 |
| | | c.JSON(401, "TableId 不存在") |
| | | return |
| | | } |
| | | result := addDbPerson(dbperson) |
| | | if result["success"].(bool) { |
| | |
| | | } |
| | | params := string(personbytes) |
| | | data, _ := esutil.PutEsDataReq(url, params) |
| | | //if data["_id"] !=""{ |
| | | // //通知比对进程缓存更新 |
| | | // discovery.AddDbMessage(&protomsg.EsPersonCacheChange{ |
| | | // Type: protomsg.EsCacheChanged_T_DbTablePerson, |
| | | // PersonId: personId, |
| | | // TableId: []string{ dbperson.TableId }, |
| | | // Feature: dbperson.FaceFeature, |
| | | // Action: protomsg.DbAction_Insert, |
| | | // }) |
| | | //} |
| | | |
| | | //c.JSON(200, changeEsRespData(data, "添加人员成功")) |
| | | result = changeEsRespData(data, "添加成功") |
| | |
| | | //c.JSON(200, changeEsRespData(data,"修改成功")) |
| | | result := changeEsRespData(data, "修改成功") |
| | | if result["success"].(bool) { |
| | | //code.Success.Message = "修改底库人员成功" |
| | | //if dbperson.Enable == 1 { |
| | | // discovery.AddDbMessage(&protomsg.EsPersonCacheChange{ |
| | | // Type: protomsg.EsCacheChanged_T_DbTablePerson, |
| | | // PersonId: dbperson.Id, |
| | | // TableId: []string{ dbperson.TableId }, |
| | | // Feature: "", |
| | | // Action: protomsg.DbAction_Insert, |
| | | // }) |
| | | //} else { |
| | | // discovery.AddDbMessage(&protomsg.EsPersonCacheChange{ |
| | | // Type: protomsg.EsCacheChanged_T_DbTablePerson, |
| | | // PersonId: dbperson.Id, |
| | | // TableId: []string{ dbperson.TableId }, |
| | | // Feature: "", |
| | | // Action: protomsg.DbAction_Delete, |
| | | // }) |
| | | //} |
| | | util.ResponseFormat(c, code.Success, result["data"]) |
| | | } else { |
| | | //code.ServiceInsideError.Message += result["msg"].(string) |
| | |
| | | //c.JSON(200, changeEsRespData(data,"删除成功")) |
| | | result := changeEsRespData(data, "删除成功") |
| | | if result["success"].(bool) { |
| | | //code.Success.Message = "删除底库人员成功" |
| | | //通知比对进程,此人已删除 |
| | | //dbperArr, e := esApi.Dbpersoninfosbyid([]string{uuid}, config.EsInfo.EsIndex.Dbtablepersons.IndexName, config.EsInfo.Masterip, config.EsInfo.Httpport) |
| | | //if e ==nil && len(dbperArr) > 0{ |
| | | // if dbperArr[0].TableId !=""{ |
| | | // discovery.AddDbMessage(&protomsg.EsPersonCacheChange{ |
| | | // Type: protomsg.EsCacheChanged_T_DbTablePerson, |
| | | // PersonId: uuid, |
| | | // TableId: []string{ dbperArr[0].TableId }, |
| | | // Feature: "", |
| | | // Action: protomsg.DbAction_Delete, |
| | | // }) |
| | | // } |
| | | //} |
| | | |
| | | util.ResponseFormat(c, code.Success, result["data"]) |
| | | } else { |
| | | //code.ServiceInsideError.Message += result["msg"].(string) |