Skip to content

Commit

Permalink
Merge pull request #2884 from JeffreySu/Developer
Browse files Browse the repository at this point in the history
优化超长文本发送的编码计算
  • Loading branch information
JeffreySu authored Jul 13, 2023
2 parents 5fc8b63 + 3a2e4cd commit 3419f83
Show file tree
Hide file tree
Showing 21 changed files with 46 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,16 @@ public override async Task<IResponseMessageBase> OnTextRequestAsync(RequestMessa
defaultResponseMessage.Content = "点击打开:https://sdk.weixin.senparc.com/WeixinJsSdk";
return defaultResponseMessage;
})
.Keyword("超长", () =>
{
var sb = new StringBuilder();
for (int i = 0; i < 40; i++)
{
sb.Append($"{i + 1}.这是一条超长文本,将会自动分成多条发送。");
}
defaultResponseMessage.Content = sb.ToString();
return defaultResponseMessage;
})


//选择菜单,关键字:101(微信服务器端最终格式:id="s:101",content="满意")
Expand Down Expand Up @@ -419,7 +429,6 @@ public override async Task<IResponseMessageBase> OnTextRequestAsync(RequestMessa
#endif
}
return defaultResponseMessage;
})
//企业微信审批
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ private string GetWelcomeInfo()
【open】 进入第三方开放平台(Senparc.Weixin.Open)测试
【超长】 测试超长文本自动分批发送
【tm】 测试异步模板消息
【openid】 获取OpenId等用户信息
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Senparc.NeuChar" Version="2.3.0" />
<PackageReference Include="Senparc.NeuChar" Version="2.3.1" />
<PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.1.0" />
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
<PackageReference Include="System.Diagnostics.FileVersionInfo" Version="4.3.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

<ItemGroup>
<PackageReference Include="Senparc.CO2NET.WebApi" Version="1.4.2" />
<PackageReference Include="Senparc.NeuChar.App" Version="1.3.0" />
<PackageReference Include="Senparc.NeuChar.AspNet" Version="1.3.1" />
<PackageReference Include="Senparc.NeuChar.App" Version="1.3.1-beta1" />
<PackageReference Include="Senparc.NeuChar.AspNet" Version="1.3.2" />

<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="7.0.0" />
Expand Down
6 changes: 4 additions & 2 deletions Samples/All/net7-mvc/Senparc.Weixin.Sample.Net7/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,10 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env,
//[可选] 对 MessageHandler 内异步方法未提供重写时,调用同步方法(按需)
options.DefaultMessageHandlerAsyncEvent = DefaultMessageHandlerAsyncEvent.SelfSynicMethod;
options.EnableRequestLog = true;//[可选] 默认就为 true,如需关闭日志,可设置为 false
options.EnbleResponseLog = true;//[可选] 默认就为 true,如需关闭日志,可设置为 false
//[可选] 默认就为 true,如需关闭请求日志,可设置为 false
options.EnableRequestLog = true;
//[可选] 默认就为 true,如需关闭回复日志,可设置为 false
options.EnbleResponseLog = true;
//[可选] 对发生异常进行处理(可选)
options.AggregateExceptionCatch = ex =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net462;netstandard2.0;netstandard2.1;netcoreapp3.1;net6.0;net7.0</TargetFrameworks>
<Version>0.17.12</Version>
<Version>0.17.12.1</Version>
<AssemblyName>Senparc.WebSocket</AssemblyName>
<RootNamespace>Senparc.WebSocket</RootNamespace>
<GeneratePackageOnBuild Condition=" '$(Configuration)' == 'Release' ">true</GeneratePackageOnBuild>
Expand Down
4 changes: 2 additions & 2 deletions src/Senparc.Weixin.AspNet/Senparc.Weixin.AspNet.net7.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net462;netstandard2.0;netstandard2.1</TargetFrameworks>
<Version>1.0.4-beta1</Version>
<Version>1.0.4.1-beta1</Version>
<AssemblyName>Senparc.Weixin.AspNet</AssemblyName>
<RootNamespace>Senparc.Weixin.AspNet</RootNamespace>
<!--<OutputType>Library</OutputType>-->
Expand Down Expand Up @@ -76,7 +76,7 @@
<PackageReference Include="Microsoft.AspNet.Mvc" Version="5.2.9" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Senparc.NeuChar.AspNet" Version="1.3.1" />
<PackageReference Include="Senparc.NeuChar.AspNet" Version="1.3.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Senparc.Weixin\Senparc.Weixin\Senparc.Weixin.net7.csproj" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net462;netstandard2.0;netstandard2.1</TargetFrameworks>
<Version>0.8.12</Version>
<Version>0.8.12.1</Version>
<AssemblyName>Senparc.Weixin.Cache.CsRedis</AssemblyName>
<RootNamespace>Senparc.Weixin.Cache.CsRedis</RootNamespace>
<GeneratePackageOnBuild Condition=" '$(Configuration)' == 'Release' ">true</GeneratePackageOnBuild>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net462;netstandard2.0;netstandard2.1</TargetFrameworks>
<Version>2.13.12</Version>
<Version>2.13.12.1</Version>
<AssemblyName>Senparc.Weixin.Cache.Memcached</AssemblyName>
<RootNamespace>Senparc.Weixin.Cache.Memcached</RootNamespace>
<Description>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net462;netstandard2.0;netstandard2.1</TargetFrameworks>
<Version>2.15.12</Version>
<Version>2.15.12.1</Version>
<AssemblyName>Senparc.Weixin.Cache.Redis</AssemblyName>
<RootNamespace>Senparc.Weixin.Cache.Redis</RootNamespace>
<GeneratePackageOnBuild Condition=" '$(Configuration)' == 'Release' ">true</GeneratePackageOnBuild>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net462;netstandard2.0;netstandard2.1;netcoreapp3.1;net6.0;net7.0</TargetFrameworks>
<Version>1.0.5-beta1</Version>
<Version>1.0.5.1-beta1</Version>
<AssemblyName>Senparc.Weixin.MP.Middleware</AssemblyName>
<RootNamespace>Senparc.Weixin.MP.Middleware</RootNamespace>
<GeneratePackageOnBuild Condition=" '$(Configuration)' == 'Release' ">true</GeneratePackageOnBuild>
Expand Down Expand Up @@ -75,7 +75,7 @@
<PackageReference Include="Microsoft.AspNet.Mvc" Version="5.2.9" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Senparc.NeuChar.AspNet" Version="1.3.1" />
<PackageReference Include="Senparc.NeuChar.AspNet" Version="1.3.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Senparc.Weixin.MP\Senparc.Weixin.MP\Senparc.Weixin.MP.net7.csproj" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net462;netstandard2.0;netstandard2.1;netcoreapp3.1;net6.0;net7.0</TargetFrameworks>
<Version>7.12.12</Version>
<Version>7.12.12.1</Version>
<AssemblyName>Senparc.Weixin.MP.MvcExtension</AssemblyName>
<RootNamespace>Senparc.Weixin.MP.MvcExtension</RootNamespace>
<GeneratePackageOnBuild Condition=" '$(Configuration)' == 'Release' ">true</GeneratePackageOnBuild>
Expand Down Expand Up @@ -151,7 +151,7 @@
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Senparc.NeuChar" Version="2.3.0" />
<PackageReference Include="Senparc.NeuChar" Version="2.3.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Senparc.Weixin.AspNet\Senparc.Weixin.AspNet.net7.csproj" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net462;netstandard2.0;netstandard2.1</TargetFrameworks>
<Version>16.19.2</Version>
<Version>16.19.2.1</Version>
<AssemblyName>Senparc.Weixin.MP</AssemblyName>
<RootNamespace>Senparc.Weixin.MP</RootNamespace>
<GeneratePackageOnBuild Condition=" '$(Configuration)' == 'Release' ">true</GeneratePackageOnBuild>
Expand Down Expand Up @@ -583,8 +583,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Senparc.CO2NET.APM" Version="1.2.5.7" />
<PackageReference Include="Senparc.NeuChar" Version="2.3.0" />
<PackageReference Include="Senparc.NeuChar.App" Version="1.3.0" />
<PackageReference Include="Senparc.NeuChar" Version="2.3.1" />
<PackageReference Include="Senparc.NeuChar.App" Version="1.3.1-beta1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Senparc.Weixin\Senparc.Weixin\Senparc.Weixin.net7.csproj" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net462;netstandard2.0;netstandard2.1</TargetFrameworks>
<Version>4.14.24</Version>
<Version>4.14.24.1</Version>
<AssemblyName>Senparc.Weixin.Open</AssemblyName>
<RootNamespace>Senparc.Weixin.Open</RootNamespace>
<GeneratePackageOnBuild Condition=" '$(Configuration)' == 'Release' ">true</GeneratePackageOnBuild>
Expand Down Expand Up @@ -258,7 +258,7 @@
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Senparc.NeuChar" Version="2.3.0" />
<PackageReference Include="Senparc.NeuChar" Version="2.3.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Senparc.Weixin\Senparc.Weixin\Senparc.Weixin.net7.csproj" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net462;netstandard2.0;netstandard2.1</TargetFrameworks>
<Version>1.12.13</Version>
<Version>1.12.13.1</Version>
<AssemblyName>Senparc.Weixin.TenPay</AssemblyName>
<RootNamespace>Senparc.Weixin.TenPay</RootNamespace>
<GeneratePackageOnBuild Condition=" '$(Configuration)' == 'Release' ">true</GeneratePackageOnBuild>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<Version>0.7.10</Version>
<Version>0.7.10.1</Version>
<AssemblyName>Senparc.Weixin.TenPayV3</AssemblyName>
<RootNamespace>Senparc.Weixin.TenPayV3</RootNamespace>
<LangVersion>10.0</LangVersion>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net462;netstandard2.0;netstandard2.1;netcoreapp3.1;net6.0;net7.0</TargetFrameworks>
<Version>1.0.5-beta1</Version>
<Version>1.0.5.1-beta1</Version>
<AssemblyName>Senparc.Weixin.Work.Middleware</AssemblyName>
<RootNamespace>Senparc.Weixin.Work.Middleware</RootNamespace>
<GeneratePackageOnBuild Condition=" '$(Configuration)' == 'Release' ">true</GeneratePackageOnBuild>
Expand Down Expand Up @@ -72,7 +72,7 @@
<Compile Remove="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Senparc.NeuChar.AspNet" Version="1.3.1" />
<PackageReference Include="Senparc.NeuChar.AspNet" Version="1.3.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Senparc.Weixin.Work\Senparc.Weixin.Work\Senparc.Weixin.Work.net7.csproj" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net462;netstandard2.0;netstandard2.1</TargetFrameworks>
<Version>3.16.2</Version>
<Version>3.16.2.1</Version>
<LangVersion>10.0</LangVersion>
<AssemblyName>Senparc.Weixin.Work</AssemblyName>
<RootNamespace>Senparc.Weixin.Work</RootNamespace>
Expand Down Expand Up @@ -251,7 +251,7 @@
<PackageReference Include="System.Xml.XPath.XmlDocument" Version="4.3.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Senparc.NeuChar" Version="2.3.0" />
<PackageReference Include="Senparc.NeuChar" Version="2.3.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Senparc.Weixin\Senparc.Weixin\Senparc.Weixin.net7.csproj" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net462;netstandard2.0;netstandard2.1;netcoreapp3.1;net6.0;net7.0</TargetFrameworks>
<Version>1.0.5-beta1</Version>
<Version>1.0.5.1-beta1</Version>
<AssemblyName>Senparc.Weixin.WxOpen.Middleware</AssemblyName>
<RootNamespace>Senparc.Weixin.WxOpen.Middleware</RootNamespace>
<GeneratePackageOnBuild Condition=" '$(Configuration)' == 'Release' ">true</GeneratePackageOnBuild>
Expand Down Expand Up @@ -72,7 +72,7 @@
<Compile Remove="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Senparc.NeuChar.AspNet" Version="1.3.1" />
<PackageReference Include="Senparc.NeuChar.AspNet" Version="1.3.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Senparc.Weixin.WxOpen\src\Senparc.Weixin.WxOpen\Senparc.Weixin.WxOpen\Senparc.Weixin.WxOpen.net7.csproj" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net462;netstandard2.0;netstandard2.1</TargetFrameworks>
<Version>3.16.2</Version>
<Version>3.16.2.1</Version>
<LangVersion>9.0</LangVersion>
<AssemblyName>Senparc.Weixin.WxOpen</AssemblyName>
<RootNamespace>Senparc.Weixin.WxOpen</RootNamespace>
Expand Down Expand Up @@ -217,7 +217,7 @@
<PackageReference Include="System.Xml.XPath.XmlDocument" Version="4.3.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Senparc.NeuChar" Version="2.3.0" />
<PackageReference Include="Senparc.NeuChar" Version="2.3.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\Senparc.Weixin.MP\Senparc.Weixin.MP\Senparc.Weixin.MP.net7.csproj" />
Expand Down
4 changes: 2 additions & 2 deletions src/Senparc.Weixin/Senparc.Weixin/Senparc.Weixin.net7.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFrameworks>net462;netstandard2.0;netstandard2.1</TargetFrameworks>
<FrameworkPathOverride Condition="'$(TargetFramework)' == 'net35'">$(Net35FrameworkPathOverride)</FrameworkPathOverride>
<Version>6.16.3</Version>
<Version>6.16.3.1</Version>
<LangVersion>10.0</LangVersion>
<AssemblyName>Senparc.Weixin</AssemblyName>
<RootNamespace>Senparc.Weixin</RootNamespace>
Expand Down Expand Up @@ -379,7 +379,7 @@
<PackageReference Include="Microsoft.Extensions.Options" Version="7.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Senparc.CO2NET" Version="2.2.1" />
<PackageReference Include="Senparc.NeuChar" Version="2.3.0" />
<PackageReference Include="Senparc.NeuChar" Version="2.3.1" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net462' ">
<Reference Include="System.Core" />
Expand Down

0 comments on commit 3419f83

Please sign in to comment.