Commit 27a46684 authored by 18310373984@163.com's avatar 18310373984@163.com

腾讯云接口增加调用记录

parent 0728cad8
...@@ -86,10 +86,17 @@ public class FaceAuthUtil { ...@@ -86,10 +86,17 @@ public class FaceAuthUtil {
log.error("增加CreatePerson接口调用记录失败:"+e.toString()); log.error("增加CreatePerson接口调用记录失败:"+e.toString());
} }
return Result.success(resp.getFaceId()); return Result.success(resp.getFaceId());
} catch ( } catch (Exception e) {
Exception e) { log.error("调用腾讯云创建人员接口返回失败:"+e.toString());
log.error(e.toString()); log.error(e.toString());
return Result.failed(e.getMessage()); try{
//增加接口调用记录
addCallFaceInterfaceLog(userId, JSON.toJSONString(faceAuthParam.getFaceId()),"CreatePerson","创建人员",
e.getMessage(),null,null,null);
}catch(Exception e1){
log.error("增加CreatePerson接口调用记录失败2:"+e1.toString());
}
return Result.failed(e.getMessage());
} }
} }
...@@ -127,19 +134,16 @@ public class FaceAuthUtil { ...@@ -127,19 +134,16 @@ public class FaceAuthUtil {
// 实例化要请求产品的client对象,clientProfile是可选的 // 实例化要请求产品的client对象,clientProfile是可选的
IaiClient client = new IaiClient(cred, faceAuthProperties.getRegion(), clientProfile); IaiClient client = new IaiClient(cred, faceAuthProperties.getRegion(), clientProfile);
// 实例化一个请求对象,每个接口都会对应一个request对象 // 实例化一个请求对象,每个接口都会对应一个request对象
DeleteFaceRequest req = new DeleteFaceRequest(); DeletePersonRequest req = new DeletePersonRequest ();
req.setPersonId(faceAuthParam.getCertifNum()); req.setPersonId(faceAuthParam.getCertifNum());
String[] faceIds1 = {faceAuthParam.getFaceId()};//人脸
req.setFaceIds(faceIds1);
// 返回的resp是一个DeleteFaceResponse的实例,与请求对象对应 // 返回的resp是一个DeleteFaceResponse的实例,与请求对象对应
DeleteFaceResponse resp = client.DeleteFace(req); DeletePersonResponse resp = client.DeletePerson(req);
// 输出json格式的字符串回包 // 输出json格式的字符串回包
System.out.println(AbstractModel.toJsonString(resp)); System.out.println(AbstractModel.toJsonString(resp));
try{ try{
//增加接口调用记录 //增加接口调用记录
addCallFaceInterfaceLog(userId, JSON.toJSONString(req.getFaceIds()),"DeleteFace","删除人脸", addCallFaceInterfaceLog(userId, req.getPersonId(),"DeleteFace","删除人脸",
AbstractModel.toJsonString(resp),null,null,null); AbstractModel.toJsonString(resp),null,null,null);
}catch(Exception e){ }catch(Exception e){
log.error("增加DeleteFace接口调用记录失败:"+e.toString()); log.error("增加DeleteFace接口调用记录失败:"+e.toString());
...@@ -148,7 +152,14 @@ public class FaceAuthUtil { ...@@ -148,7 +152,14 @@ public class FaceAuthUtil {
return Result.success(resp.getRequestId()); return Result.success(resp.getRequestId());
} catch (Exception e) { } catch (Exception e) {
log.error(e.toString()); try{
//增加接口调用记录
addCallFaceInterfaceLog(userId, faceAuthParam.getCertifNum(),"DeleteFace","删除人脸",
e.getMessage(),null,null,null);
}catch(Exception e1){
log.error("增加DeleteFace接口调用记录失败2:"+e1.toString());
}
log.error("调用腾讯云删除人脸接口返回失败:"+e.toString());
return Result.failed(e.getMessage()); return Result.failed(e.getMessage());
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment