Skip to content

Commit

Permalink
为微信回调处理器基类添加异常日志输出功能。 🌿
Browse files Browse the repository at this point in the history
  • Loading branch information
PopeyeZhong committed Sep 6, 2022
1 parent 3cbb103 commit d199aad
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion externals/wechat/src/Paying/FallbackHandlerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,18 @@ internal async ValueTask<OperationResult<TRequest>> GetRequestAsync(object calle

var message = await JsonSerializer.DeserializeAsync<FallbackMessage>(input, null, cancellation);
var resource = message.Resource;
var data = CryptographyHelper.Decrypt1(authority.Secret, resource.Nonce, resource.AssociatedData, resource.Ciphertext);
byte[] data;

try
{
data = CryptographyHelper.Decrypt1(authority.Secret, resource.Nonce, resource.AssociatedData, resource.Ciphertext);
}
catch(Exception ex)
{
Zongsoft.Diagnostics.Logger.Error(ex, $"微信回调解密出错:\nAuthority.name:{authority.Name}\nAuthority.Secret:{authority.Secret}\nResource.Nonce:{resource.Nonce}\nResource.AssociatedData:{resource.AssociatedData}\nResource.Ciphertext:{resource.Ciphertext}");
return OperationResult.Fail(ex);
}

var payload = JsonSerializer.Deserialize(data, GetRequestType(format), Json.Options);
return OperationResult.Success((TRequest)payload);
}
Expand Down

0 comments on commit d199aad

Please sign in to comment.