fix 外部接口调用封装处理

This commit is contained in:
2025-11-13 17:56:31 +08:00
parent 25f36f8d12
commit c84b8e4954
2 changed files with 63 additions and 39 deletions

View File

@@ -103,6 +103,9 @@ public class AppointmentService : IAppointmentService
var detail = await _dbContext.Queryable<VisitorAppointmentDetailEntity>().Where(x => x.Id == request.Id).SingleAsync();
detail.ThrowIfNull("预约信息不存在");
//提前传
await UploadFaceToDhAsync(detail.IdNo, request.Base64Image);
if (detail.DoorStatus == VisitorAppointmentDetailStatusEnumType.Wait)
{
detail.DoorStatus = VisitorAppointmentDetailStatusEnumType.Arrived;
@@ -122,16 +125,19 @@ public class AppointmentService : IAppointmentService
});
await GenerateDeviceTasksAsync(detail, false, DeviceTaskEnumType.Add, "访客门岗认证生成");
}
private async Task UploadFaceToDhAsync(string idNo, string base64Image)
{
try
{
var r = await _dhApi.SendFaceAsync(new FaceRequest
{
IdNo = detail.IdNo,
Face = request.Base64Image
IdNo = idNo,
Face = base64Image
});
_logger.LogInformation("上传face数据到大华成功: {idNo} . {json}", detail.IdNo, r.ToJson());
_logger.LogInformation("上传face数据到大华成功: {idNo} . {json}", idNo, r.ToJson());
}
catch (Exception e)
{