Skip to content

Commit

Permalink
docs: 完善文档
Browse files Browse the repository at this point in the history
  • Loading branch information
fudiwei committed Jan 25, 2022
1 parent 340910f commit 05cd78a
Show file tree
Hide file tree
Showing 9 changed files with 650 additions and 4 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
| 名称 | NuGet | 其他 |
| :--------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------: |
| 公众平台(公众号、小程序) <br> + 开放平台模块 | [![NuGet Version](https://img.shields.io/nuget/v/SKIT.FlurlHttpClient.Wechat.Api.svg?label=NuGet)](https://www.nuget.org/packages/SKIT.FlurlHttpClient.Wechat.Api) <br> [![NuGet Download](https://img.shields.io/nuget/dt/SKIT.FlurlHttpClient.Wechat.Api.svg?sanitize=true&label=Downloads)](https://www.nuget.org/packages/SKIT.FlurlHttpClient.Wechat.Api) | [开发文档](./docs/WechatApi/README.md)[示例项目](./docs/WechatApi/Sample.md) |
| 商户平台(微信支付)模块 | [![NuGet Version](https://img.shields.io/nuget/v/SKIT.FlurlHttpClient.Wechat.TenpayV3.svg?label=NuGet)](https://www.nuget.org/packages/SKIT.FlurlHttpClient.Wechat.TenpayV3) <br> [![NuGet Download](https://img.shields.io/nuget/dt/SKIT.FlurlHttpClient.Wechat.TenpayV3.svg?sanitize=true&label=Downloads)](https://www.nuget.org/packages/SKIT.FlurlHttpClient.Wechat.TenpayV3) | [开发文档](./docs/WechatTenpayV3/README.md)[示例项目](./docs/WechatTenpayV3/Sample.md) |
| 商户平台(微信支付)模块 <br> (v3 版) | [![NuGet Version](https://img.shields.io/nuget/v/SKIT.FlurlHttpClient.Wechat.TenpayV3.svg?label=NuGet)](https://www.nuget.org/packages/SKIT.FlurlHttpClient.Wechat.TenpayV3) <br> [![NuGet Download](https://img.shields.io/nuget/dt/SKIT.FlurlHttpClient.Wechat.TenpayV3.svg?sanitize=true&label=Downloads)](https://www.nuget.org/packages/SKIT.FlurlHttpClient.Wechat.TenpayV3) | [开发文档](./docs/WechatTenpayV3/README.md)[示例项目](./docs/WechatTenpayV3/Sample.md) |
| 商户平台(微信支付)模块 <br> (v2 版) | [![NuGet Version](https://img.shields.io/nuget/v/SKIT.FlurlHttpClient.Wechat.TenpayV2.svg?label=NuGet)](https://www.nuget.org/packages/SKIT.FlurlHttpClient.Wechat.TenpayV2) <br> [![NuGet Download](https://img.shields.io/nuget/dt/SKIT.FlurlHttpClient.Wechat.TenpayV2.svg?sanitize=true&label=Downloads)](https://www.nuget.org/packages/SKIT.FlurlHttpClient.Wechat.TenpayV2) | [开发文档](./docs/WechatTenpayV2/README.md) |
| 企业微信(企业号)模块 | [![NuGet Version](https://img.shields.io/nuget/v/SKIT.FlurlHttpClient.Wechat.Work.svg?label=NuGet)](https://www.nuget.org/packages/SKIT.FlurlHttpClient.Wechat.Work) <br> [![NuGet Download](https://img.shields.io/nuget/dt/SKIT.FlurlHttpClient.Wechat.Work.svg?sanitize=true&label=Downloads)](https://www.nuget.org/packages/SKIT.FlurlHttpClient.Wechat.Work) | [开发文档](./docs/WechatWork/README.md) |
| 广告平台(广点通)模块 | [![NuGet Version](https://img.shields.io/nuget/v/SKIT.FlurlHttpClient.Wechat.Ads.svg?label=NuGet)](https://www.nuget.org/packages/SKIT.FlurlHttpClient.Wechat.Ads) <br> [![NuGet Download](https://img.shields.io/nuget/dt/SKIT.FlurlHttpClient.Wechat.Ads.svg?sanitize=true&label=Downloads)](https://www.nuget.org/packages/SKIT.FlurlHttpClient.Wechat.Ads) | [开发文档](./docs/WechatAds/README.md) |
| 对话开放平台(微信智能对话)模块 | [![NuGet Version](https://img.shields.io/nuget/v/SKIT.FlurlHttpClient.Wechat.OpenAI.svg?label=NuGet)](https://www.nuget.org/packages/SKIT.FlurlHttpClient.Wechat.OpenAI) <br> [![NuGet Download](https://img.shields.io/nuget/dt/SKIT.FlurlHttpClient.Wechat.OpenAI.svg?sanitize=true&label=Downloads)](https://www.nuget.org/packages/SKIT.FlurlHttpClient.Wechat.OpenAI) | [开发文档](./docs/WechatOpenAI/README.md) |
Expand Down Expand Up @@ -106,8 +107,8 @@

## 使用案例

| 项目名称 | 项目简介 | 项目地址 |
| :------: | :--------------------------------------------: | :--------------------------------------------------------------------------------------------------------: |
| 项目名称 | 项目简介 | 项目地址 |
| :------: | :--------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| CoreShop | 核心商城系统:支持可视化布局的 .NET 商城系统。 | [![Gitee Stars](https://gitee.com/CoreUnion/CoreShop/badge/star.svg?title=Stars)](https://gitee.com/CoreUnion/CoreShop)<br>[![GitHub Stars](https://img.shields.io/github/stars/CoreUnion/CoreShop?logo=github&label=Stars)](https://github.com/CoreUnion/CoreShop) |

注:以上案例均来自第三方,本项目不对其项目做任何保证,仅作列举展示。如果你有项目也使用了本库、希望加到案例列表中,可以在 Issue 中提出。
Expand Down
25 changes: 25 additions & 0 deletions docs/WechatTenpayV2/Advanced_EventResourceDecryption.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## 如何解密回调通知事件中的敏感数据?

---

### 解密流程

对于回调通知事件的敏感信息,微信商户平台使用了商户密钥基于 AES 算法加密。

开发者可利用本库提供的 `AESUtility` 工具类自行解密相关字段。

此外,本库还封装了直接解密事件的扩展方法,下面给出一个示例代码:

```csharp
/* 微信商户平台发来的通知内容 */
string callbackXml = "<xml> ... </xml>";
/* 将 XML 反序列化得到通知对象 */
var callbackModel = client.DeserializeEvent(callbackJson);
/* 解密得到支付通知敏感数据(以退款结果通知为例) */
var callbackResource = client.DecryptEventRequestInfo<Events.RefundEventRequestInfo>(callbackModel);
string outRefundNumber = callbackResource.OutRefundNumber;
string refundId = callbackResource.RefundId;
}
```

完整的回调通知模型定义可以参考项目目录下的 _src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Events_ 目录。
15 changes: 15 additions & 0 deletions docs/WechatTenpayV2/Advanced_EventSignatureVerification.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## 如何验证回调通知事件签名?

---

### 验签流程

你可根据官方文档的规则利用本库提供的 `MD5Utility``HMACUtility` 工具类自行进行签名验证。

此外,本库还封装了直接解密事件的扩展方法,下面给出一个示例代码:

```csharp
bool ret = client.VerifyEventSignature(
callbackBody: "<xml> 微信回调通知中请求正文 XML 内容 </xml>"
);
```
5 changes: 5 additions & 0 deletions docs/WechatTenpayV2/Advanced_Interceptor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## 如何使用拦截器?

---

拦截器在本库下的用法与在 [SKIT.FlurlHttpClient.Wechat.Api](../WechatApi/README.md) 模块下的用法类似,请参阅[相关文档](../WechatApi/Advanced_Interceptor.md)
5 changes: 5 additions & 0 deletions docs/WechatTenpayV2/Advanced_JsonSerializer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## 如何指定 JSON 序列化器?

---

JSON 序列化器在本库下的用法与在 [SKIT.FlurlHttpClient.Wechat.Api](../WechatApi/README.md) 模块下的用法类似,请参阅[相关文档](../WechatApi/Advanced_JsonSerializer.md)
Loading

0 comments on commit 05cd78a

Please sign in to comment.