fix 减少异常日志输出

This commit is contained in:
2025-10-28 11:24:42 +08:00
parent ad144a9e16
commit b6af5f2e93
2 changed files with 5 additions and 3 deletions

View File

@@ -8,5 +8,5 @@ public interface IHainingApi
{ {
[RequestLog] [RequestLog]
[Post("/jingke/api/face/SaveFaceByFace")] [Post("/jingke/api/face/SaveFaceByFace")]
Task<object> UploadAsync(HainingApiUploadRequest request); Task UploadAsync(HainingApiUploadRequest request);
} }

View File

@@ -250,6 +250,7 @@ public class GainfoFaceService : IGainfoFaceService
var timeLimitedDataProtector = _dataProtectionProvider.CreateProtector("down:face").ToTimeLimitedDataProtector(); var timeLimitedDataProtector = _dataProtectionProvider.CreateProtector("down:face").ToTimeLimitedDataProtector();
try try
{ {
//解密token,如果非法和过期会抛异常
var password = timeLimitedDataProtector.Unprotect(token); var password = timeLimitedDataProtector.Unprotect(token);
var userCode = password.Split(':')[1]; var userCode = password.Split(':')[1];
@@ -262,9 +263,10 @@ public class GainfoFaceService : IGainfoFaceService
return new FileContentResult(Convert.FromBase64String(face.Face), "image/png"); return new FileContentResult(Convert.FromBase64String(face.Face), "image/png");
} }
catch (Exception ex) catch
{ {
_logger.LogError(ex, "获取人脸失败:{message}", ex.Message); //已经验证没有问题,后续不需要输出多余日志
//_logger.LogError(ex, "获取人脸失败:{message}", ex.Message);
return new NotFoundResult(); return new NotFoundResult();
} }
} }