Skip to content

Commit 0416684

Browse files
authored
Merge pull request #3225 from JeffreySu/Developer
Developer
2 parents 40ea756 + 5278983 commit 0416684

File tree

4 files changed

+37
-12
lines changed

4 files changed

+37
-12
lines changed

Samples/All/net10-mvc/Senparc.Weixin.Sample.Net10/Controllers/Tools/AiDocController.cs

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,17 @@ 2. 结果需要严格使用 JSON 格式输出(注意:不需要包含任何 m
156156
<li>AccessToken需要定期刷新,建议使用SDK自动管理</li>
157157
<li>接口调用频率限制:100万次/天</li></ul>""}}
158158
159+
返回结果所对应的反序列化类为:
160+
public class QueryMcpResult
161+
{{
162+
public string Platform {{ get; set; }}
163+
public string ApiDescription {{ get; set; }}
164+
public string CSharpCode {{ get; set; }}
165+
public string Tips {{ get; set; }}
166+
public string ParamsDescription {{ get; set; }}
167+
public string Summary {{ get; set; }}
168+
}}
169+
159170
### JSON 参数说明
160171
1. Platform 根据选择的平台进行匹配:
161172
{Senparc.NeuChar.PlatformType.WeChat_OfficialAccount}:微信公众号
@@ -166,6 +177,7 @@ 2. 如果过程中涉及到了多个接口,则在 ParamsDescription 中遍历
166177
3. Tips 请根据接口实际说明进行调整
167178
4. 第一个参数为 accessTokenOrAppId 时,优先使用 appId 而不是 accessToken,因此不需要 accessToken 参数,因为 SDK 推荐提前注册并自动管理 AccessToken。
168179
5. 请不要添加任何不确定的信息或有风险的代码
180+
6. 输出结果必须是干净、完整的一段 JSON
169181
170182
## API 查询要求
171183
{request.Query}
@@ -376,14 +388,14 @@ public class QueryRequest
376388
public string Query { get; set; }
377389
}
378390

379-
public class QueryMcpResult
380-
{
381-
public string Platform { get; set; }
382-
public string ApiDescription { get; set; }
383-
public string CSharpCode { get; set; }
384-
public string Tips { get; set; }
385-
public string ParamsDescription { get; set; }
386-
public string Summary { get; set; }
387-
}
391+
public class QueryMcpResult
392+
{
393+
public string Platform { get; set; }
394+
public string ApiDescription { get; set; }
395+
public string CSharpCode { get; set; }
396+
public string Tips { get; set; }
397+
public string ParamsDescription { get; set; }
398+
public string Summary { get; set; }
399+
}
388400
}
389401
}

Samples/All/net10-mvc/Senparc.Weixin.Sample.Net10/Senparc.Weixin.Sample.net10.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Project Sdk="Microsoft.NET.Sdk.Web">
33
<PropertyGroup>
44
<TargetFramework>net10.0</TargetFramework>
5-
<Version>10.0.0</Version>
5+
<Version>10.0.1</Version>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<UserSecretsId>35e58786-0820-4cde-b1ff-f4c6198d00f7</UserSecretsId>
88
<PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>

src/Senparc.Weixin.TenPay/Senparc.Weixin.TenPayV3/HttpHandlers/TenPayNotifyHandler.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ and limitations under the License.
4747
using Senparc.Weixin.TenPayV3.Helpers;
4848
using System;
4949
using System.IO;
50+
using System.Text;
5051
using System.Threading.Tasks;
5152

5253

@@ -87,11 +88,22 @@ public TenPayNotifyHandler(HttpContext httpContext, ISenparcWeixinSettingForTenp
8788
|| _httpContext.Request.Method == "PUT"
8889
|| _httpContext.Request.Method == "PATCH")
8990
{
90-
using (var reader = new StreamReader(_httpContext.Request.Body))
91+
// 启用缓冲(允许重复读取)
92+
_httpContext.Request.EnableBuffering();
93+
94+
using (var reader = new StreamReader(
95+
_httpContext.Request.Body,
96+
encoding: Encoding.UTF8,
97+
detectEncodingFromByteOrderMarks: false,
98+
bufferSize: 1024,
99+
leaveOpen: true)) // 关键:读取后不关闭底层流
91100
{
92101
Body = reader.ReadToEndAsync().GetAwaiter().GetResult();
93102
NotifyRequest = Body.GetObject<NotifyRequest>();
94103
}
104+
105+
// 重置流位置,供后续中间件/控制器读取
106+
_httpContext.Request.Body.Position = 0;
95107
}
96108
}
97109

src/Senparc.Weixin.TenPay/Senparc.Weixin.TenPayV3/Senparc.Weixin.TenPayV3.net10.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<TargetFramework>netstandard2.1</TargetFramework>
4-
<Version>2.3.0</Version>
4+
<Version>2.3.1</Version>
55
<AssemblyName>Senparc.Weixin.TenPayV3</AssemblyName>
66
<RootNamespace>Senparc.Weixin.TenPayV3</RootNamespace>
77
<LangVersion>10.0</LangVersion>
@@ -65,6 +65,7 @@
6565
[2025-07-08] v2.1.1 微信支付分 增加参数device /PR #3156 / Issue #3155 感谢 @mojinxun @zariczhu
6666
[2025-08-17] v2.2.1-beta.1 处理 ResponseErrorJsonResult 中 value 值类型,由 string[] 改为 int
6767
[2025-08-19] v2.2.1 处理 ResponseErrorJsonResult 中 value 值类型,由 int 改为 object
68+
[2025-11-26] v2.3.1 修复 TenPayNotifyHandler 中 Body 赋值问题 / Issue #3220 感谢 @wind2006
6869
</PackageReleaseNotes>
6970
<RepositoryUrl>https://github.com/JeffreySu/WeiXinMPSDK</RepositoryUrl>
7071
</PropertyGroup>

0 commit comments

Comments
 (0)