diff --git a/.gitignore b/.gitignore index c63879ca9e..7c004b3406 100644 --- a/.gitignore +++ b/.gitignore @@ -67,3 +67,4 @@ yarn.lock /Samples/MP/Senparc.Weixin.Sample.MP.Simple/appsettings.Development.json /src/Senparc.Weixin.MP/Senparc.Weixin.MP.Test/AdvancedAPIs/Media/*.jpg /src/Senparc.Weixin.MP/Senparc.Weixin.MP.Test/*.jpg +/Samples/SamplePublish/ diff --git a/Samples/All/net8-mvc/Senparc.Weixin.Sample.Net8.sln b/Samples/All/net8-mvc/Senparc.Weixin.Sample.Net8.sln index 51b3784bb9..81814c4fed 100644 --- a/Samples/All/net8-mvc/Senparc.Weixin.Sample.Net8.sln +++ b/Samples/All/net8-mvc/Senparc.Weixin.Sample.Net8.sln @@ -74,9 +74,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Senparc.Weixin.TenPayV3.Tes EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Senparc.Weixin.Sample.MP.net8", "..\..\MP\Senparc.Weixin.Sample.MP\Senparc.Weixin.Sample.MP.net8.csproj", "{81A078A9-97D1-446D-88ED-87F4BB484D91}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "3.2 不同微信模块 Samples", "3.2 不同微信模块 Samples", "{34CFB1D8-6025-4E93-A67F-D94DD3B9198F}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "03.02 不同微信模块 Samples", "03.02 不同微信模块 Samples", "{34CFB1D8-6025-4E93-A67F-D94DD3B9198F}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "3.1 完整 Sample(进阶)", "3.1 完整 Sample(进阶)", "{1B168C93-E3E3-4939-8EDC-19CE4E041874}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "03.01 完整 Sample(进阶)", "03.01 完整 Sample(进阶)", "{1B168C93-E3E3-4939-8EDC-19CE4E041874}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Senparc.Weixin.Sample.Shared", "..\..\Shared\Senparc.Weixin.Sample.Shared\Senparc.Weixin.Sample.Shared.shproj", "{9FE36012-8B32-488E-96AD-BA7CEDAEEAB8}" EndProject @@ -95,7 +95,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Senparc.Weixin.Sample.TenPa EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Senparc.Weixin.Sample.Shared", "..\Senparc.Weixin.Sample.Shared\Senparc.Weixin.Sample.Shared.shproj", "{81A03BCD-B887-4A40-8867-FF6B8D61CFC3}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "3.3 人工智能(AI)", "3.3 人工智能(AI)", "{AB1460AF-4BE8-4CC2-AF3B-3473B5A41778}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "03.03 人工智能(AI)", "03.03 人工智能(AI)", "{AB1460AF-4BE8-4CC2-AF3B-3473B5A41778}" ProjectSection(SolutionItems) = preProject ..\..\..\Samples with AI\readme.md = ..\..\..\Samples with AI\readme.md EndProjectSection diff --git a/Samples/All/net8-mvc/Senparc.Weixin.Sample.Net8/Views/Home/Index.cshtml b/Samples/All/net8-mvc/Senparc.Weixin.Sample.Net8/Views/Home/Index.cshtml index b918eb6100..898b0726cd 100644 --- a/Samples/All/net8-mvc/Senparc.Weixin.Sample.Net8/Views/Home/Index.cshtml +++ b/Samples/All/net8-mvc/Senparc.Weixin.Sample.Net8/Views/Home/Index.cshtml @@ -41,7 +41,7 @@ 目前 Senparc.Weixin SDK 已支持微信 8.x API 中几乎所有接口以及小程序

- 当前站点运行 Sample + 当前站点运行 Sample 版本:v@(TempData["SampleVersion"]) (@TempData["BuildTime"])

 

diff --git a/Samples/MP/Senparc.Weixin.Sample.MP.Simple/MessageHandlers/CustomMessageHandler.cs b/Samples/MP/Senparc.Weixin.Sample.MP.Simple/MessageHandlers/CustomMessageHandler.cs index 0aa4894583..099c02c45c 100644 --- a/Samples/MP/Senparc.Weixin.Sample.MP.Simple/MessageHandlers/CustomMessageHandler.cs +++ b/Samples/MP/Senparc.Weixin.Sample.MP.Simple/MessageHandlers/CustomMessageHandler.cs @@ -20,6 +20,9 @@ using Senparc.Weixin.MP.Entities.Request; using Senparc.Weixin.MP.MessageContexts; using Senparc.Weixin.MP.MessageHandlers; +using System; +using System.IO; +using System.Threading.Tasks; namespace Senparc.Weixin.Sample.MP { diff --git a/Samples/MP/Senparc.Weixin.Sample.MP.Simple/Senparc.Weixin.Sample.MP.Simple.csproj b/Samples/MP/Senparc.Weixin.Sample.MP.Simple/Senparc.Weixin.Sample.MP.Simple.csproj index 5dc5a443f2..fa4f718bd0 100644 --- a/Samples/MP/Senparc.Weixin.Sample.MP.Simple/Senparc.Weixin.Sample.MP.Simple.csproj +++ b/Samples/MP/Senparc.Weixin.Sample.MP.Simple/Senparc.Weixin.Sample.MP.Simple.csproj @@ -16,7 +16,7 @@ - + diff --git a/Samples/MP/Senparc.Weixin.Sample.MP.Simple/Views/Home/Index.cshtml b/Samples/MP/Senparc.Weixin.Sample.MP.Simple/Views/Home/Index.cshtml index 574d1d243c..2a280dc817 100644 --- a/Samples/MP/Senparc.Weixin.Sample.MP.Simple/Views/Home/Index.cshtml +++ b/Samples/MP/Senparc.Weixin.Sample.MP.Simple/Views/Home/Index.cshtml @@ -382,7 +382,7 @@ var result = await Senparc.Weixin.MP.AdvancedAPIs.UserApi.GetAsync(accessToken); wx.ready(function () { var url = '@(Context.Request.Scheme)://sdk.weixin.senparc.com'; - var link = url + '@(Context.Request.PathAndQuery())'; + var link = url + '@(Context.Request.Path + Context.Request.QueryString)'; var imgUrl = url + '/images/v2/ewm_01.png'; //转发到朋友圈 diff --git a/Samples/MP/Senparc.Weixin.Sample.MP.sln b/Samples/MP/Senparc.Weixin.Sample.MP.sln index 1dd87c1ad8..f38b9da116 100644 --- a/Samples/MP/Senparc.Weixin.Sample.MP.sln +++ b/Samples/MP/Senparc.Weixin.Sample.MP.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.0.31903.59 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Senparc.Weixin.Sample.MP", "Senparc.Weixin.Sample.MP\Senparc.Weixin.Sample.MP.csproj", "{99EEB8CC-FE5E-4A1D-80C2-9A0C1FA757BD}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Senparc.Weixin.Sample.MP", "Senparc.Weixin.Sample.MP\Senparc.Weixin.Sample.MP.net8.csproj", "{99EEB8CC-FE5E-4A1D-80C2-9A0C1FA757BD}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Senparc.Weixin.Sample.MP.Simple", "Senparc.Weixin.Sample.MP.Simple\Senparc.Weixin.Sample.MP.Simple.csproj", "{4A5EF3E4-3466-49C6-8A16-85EA6BD781BF}" EndProject diff --git a/Samples/MP/Senparc.Weixin.Sample.MP/Controllers/WeixinController.cs b/Samples/MP/Senparc.Weixin.Sample.MP/Controllers/WeixinController.cs index 4d31b02d72..5a4dce18fd 100644 --- a/Samples/MP/Senparc.Weixin.Sample.MP/Controllers/WeixinController.cs +++ b/Samples/MP/Senparc.Weixin.Sample.MP/Controllers/WeixinController.cs @@ -34,7 +34,10 @@ namespace Senparc.Weixin.Sample.MP.Controllers using Senparc.Weixin.MP; using Senparc.Weixin.MP.Entities.Request; using Senparc.Weixin.MP.MvcExtension; - + using System; + using System.IO; + using System.Threading; + using System.Threading.Tasks; public partial class WeixinController : BaseController { diff --git a/Samples/MP/Senparc.Weixin.Sample.MP/MessageHandlers/CustomMessageHandler.cs b/Samples/MP/Senparc.Weixin.Sample.MP/MessageHandlers/CustomMessageHandler.cs index a21b365636..99c2516691 100644 --- a/Samples/MP/Senparc.Weixin.Sample.MP/MessageHandlers/CustomMessageHandler.cs +++ b/Samples/MP/Senparc.Weixin.Sample.MP/MessageHandlers/CustomMessageHandler.cs @@ -25,6 +25,11 @@ using Senparc.Weixin.MP.Entities.Request; using Senparc.Weixin.MP.MessageContexts; using Senparc.Weixin.MP.MessageHandlers; +using System; +using System.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; namespace Senparc.Weixin.Sample.MP { diff --git a/Samples/MP/Senparc.Weixin.Sample.MP/MessageHandlers/CustomMessageHandler_Events.cs b/Samples/MP/Senparc.Weixin.Sample.MP/MessageHandlers/CustomMessageHandler_Events.cs index ac9996591b..c1de9f7f34 100644 --- a/Samples/MP/Senparc.Weixin.Sample.MP/MessageHandlers/CustomMessageHandler_Events.cs +++ b/Samples/MP/Senparc.Weixin.Sample.MP/MessageHandlers/CustomMessageHandler_Events.cs @@ -16,6 +16,7 @@ using Senparc.Weixin.MP.AdvancedAPIs; using Senparc.Weixin.MP.Entities; using System.Diagnostics; +using System.Threading.Tasks; namespace Senparc.Weixin.Sample.MP diff --git a/Samples/MP/Senparc.Weixin.Sample.MP/Senparc.Weixin.Sample.MP.net8.csproj b/Samples/MP/Senparc.Weixin.Sample.MP/Senparc.Weixin.Sample.MP.net8.csproj index 8201dd7764..9b39fbd9dd 100644 --- a/Samples/MP/Senparc.Weixin.Sample.MP/Senparc.Weixin.Sample.MP.net8.csproj +++ b/Samples/MP/Senparc.Weixin.Sample.MP/Senparc.Weixin.Sample.MP.net8.csproj @@ -24,10 +24,10 @@ - - - - + + + + @@ -37,6 +37,4 @@ --> - - diff --git a/Samples/MP/Senparc.Weixin.Sample.MP/Views/Home/Index.cshtml b/Samples/MP/Senparc.Weixin.Sample.MP/Views/Home/Index.cshtml index 574d1d243c..2a280dc817 100644 --- a/Samples/MP/Senparc.Weixin.Sample.MP/Views/Home/Index.cshtml +++ b/Samples/MP/Senparc.Weixin.Sample.MP/Views/Home/Index.cshtml @@ -382,7 +382,7 @@ var result = await Senparc.Weixin.MP.AdvancedAPIs.UserApi.GetAsync(accessToken); wx.ready(function () { var url = '@(Context.Request.Scheme)://sdk.weixin.senparc.com'; - var link = url + '@(Context.Request.PathAndQuery())'; + var link = url + '@(Context.Request.Path + Context.Request.QueryString)'; var imgUrl = url + '/images/v2/ewm_01.png'; //转发到朋友圈 diff --git a/Samples/MP/readme.md b/Samples/MP/readme.md index abfbb36675..3062ec5140 100644 --- a/Samples/MP/readme.md +++ b/Samples/MP/readme.md @@ -9,7 +9,7 @@ 项目 | 说明 ---- | ---- Senparc.Weixin.Sample.MP | 公众号主要功能的简要演示项目 -Senparc.Weixin.Sample.MP.Simple | 公众号的精简模式演示项目 +Senparc.Weixin.Sample.MP.Simple | 公众号的最精简模式演示项目 > 此项目中所演示的精简模式等,都可以举一反三用在其他平台上(如小程序、企业微信、微信支付等)。 diff --git a/Samples/Shared/Senparc.Weixin.Sample.Shared/Views/Shared/_AboutPartial.cshtml b/Samples/Shared/Senparc.Weixin.Sample.Shared/Views/Shared/_AboutPartial.cshtml index 3eee235c85..f938715846 100644 --- a/Samples/Shared/Senparc.Weixin.Sample.Shared/Views/Shared/_AboutPartial.cshtml +++ b/Samples/Shared/Senparc.Weixin.Sample.Shared/Views/Shared/_AboutPartial.cshtml @@ -6,7 +6,7 @@ .NET 3.5 / 4.0 / 4.5 / .NET Standard 2.x / .NET Core 2.x / .NET Core 3.x / .NET 6.0 / .NET 8.0 多种框架。

Senparc.Weixin SDK 是目前使用率最高的微信 .NET SDK,也是国内最受欢迎的 .NET 开源项目之一,是唯一入选 2021“科创中国”开源创新榜[1] [2] 的 .NET 项目。

-

项目自 2012 年开源,2013 年 1 月起正式发布到 GitHub。10 余年来,我们一直保持着项目的持续更新,并将完整的源代码以及设计思想毫无保留地分享给大家,希望有更多的人可以从中受益,理解并传播开源的精神,一同助力中国开源事业!感恩一路上给我们提供帮助的朋友们!

+

项目自 2012 年开源,2013 年 1 月起正式发布到 GitHub。十几年来,我们一直保持着项目的持续更新,并将完整的源代码以及设计思想毫无保留地分享给大家,希望有更多的人可以从中受益,理解并传播开源的精神,一同助力中国开源事业!感恩一路上给我们提供帮助的朋友们!

团队

Senparc.Weixin 由盛派网络及盛派开发者社区核心团队负责维护,同时正在得到大量来自社区成员和社会各界的支持,欢迎加入我们!

diff --git a/Samples/TenPayV2/Senparc.Weixin.Sample.TenPayV2/GlobalUsing.cs b/Samples/TenPayV2/Senparc.Weixin.Sample.TenPayV2/GlobalUsing.cs index 57d31a91a3..16687ffe6a 100644 --- a/Samples/TenPayV2/Senparc.Weixin.Sample.TenPayV2/GlobalUsing.cs +++ b/Samples/TenPayV2/Senparc.Weixin.Sample.TenPayV2/GlobalUsing.cs @@ -7,3 +7,8 @@ global using Microsoft.Extensions.Options; global using Senparc.Weixin.Entities; global using Microsoft.Extensions.FileProviders; +global using Microsoft.AspNetCore.Builder; +global using Microsoft.AspNetCore.Http; +global using Microsoft.Extensions.DependencyInjection; +global using Microsoft.Extensions.Hosting; +global using System.IO; \ No newline at end of file diff --git a/Samples/TenPayV2/Senparc.Weixin.Sample.TenPayV2/Program.cs b/Samples/TenPayV2/Senparc.Weixin.Sample.TenPayV2/Program.cs index 368ba19986..2c78a0e6ca 100644 --- a/Samples/TenPayV2/Senparc.Weixin.Sample.TenPayV2/Program.cs +++ b/Samples/TenPayV2/Senparc.Weixin.Sample.TenPayV2/Program.cs @@ -1,4 +1,6 @@ -var builder = WebApplication.CreateBuilder(args); +using Senparc.Weixin.RegisterServices; + +var builder = WebApplication.CreateBuilder(args); // Add services to the container. builder.Services.AddControllersWithViews(); diff --git a/Samples/TenPayV2/Senparc.Weixin.Sample.TenPayV2/Senparc.Weixin.Sample.TenPayV2.net8.csproj b/Samples/TenPayV2/Senparc.Weixin.Sample.TenPayV2/Senparc.Weixin.Sample.TenPayV2.net8.csproj index aa1f62a071..ab134a3fa5 100644 --- a/Samples/TenPayV2/Senparc.Weixin.Sample.TenPayV2/Senparc.Weixin.Sample.TenPayV2.net8.csproj +++ b/Samples/TenPayV2/Senparc.Weixin.Sample.TenPayV2/Senparc.Weixin.Sample.TenPayV2.net8.csproj @@ -24,10 +24,10 @@ - - - - + + + + diff --git a/Samples/TenPayV3/Senparc.Weixin.Sample.TenPayV3/Program.cs b/Samples/TenPayV3/Senparc.Weixin.Sample.TenPayV3/Program.cs index 8cf23ad5c6..6c5d3c2e5c 100644 --- a/Samples/TenPayV3/Senparc.Weixin.Sample.TenPayV3/Program.cs +++ b/Samples/TenPayV3/Senparc.Weixin.Sample.TenPayV3/Program.cs @@ -1,4 +1,10 @@ -var builder = WebApplication.CreateBuilder(args); +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using System.IO; + +var builder = WebApplication.CreateBuilder(args); // Add services to the container. builder.Services.AddControllersWithViews(); diff --git a/Samples/TenPayV3/Senparc.Weixin.Sample.TenPayV3/Senparc.Weixin.Sample.TenPayV3.net8.csproj b/Samples/TenPayV3/Senparc.Weixin.Sample.TenPayV3/Senparc.Weixin.Sample.TenPayV3.net8.csproj index 86a9759b57..36a830c608 100644 --- a/Samples/TenPayV3/Senparc.Weixin.Sample.TenPayV3/Senparc.Weixin.Sample.TenPayV3.net8.csproj +++ b/Samples/TenPayV3/Senparc.Weixin.Sample.TenPayV3/Senparc.Weixin.Sample.TenPayV3.net8.csproj @@ -25,10 +25,10 @@ - - - - + + + + diff --git a/Samples/Work/Senparc.Weixin.Sample.Work/Program.cs b/Samples/Work/Senparc.Weixin.Sample.Work/Program.cs index 1ccce656db..9872a5140d 100644 --- a/Samples/Work/Senparc.Weixin.Sample.Work/Program.cs +++ b/Samples/Work/Senparc.Weixin.Sample.Work/Program.cs @@ -1,4 +1,9 @@ +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; using Senparc.Weixin.Work.Containers; +using System.IO; var builder = WebApplication.CreateBuilder(args); diff --git a/Samples/Work/Senparc.Weixin.Sample.Work/Senparc.Weixin.Sample.Work.net8.csproj b/Samples/Work/Senparc.Weixin.Sample.Work/Senparc.Weixin.Sample.Work.net8.csproj index 1b258813c7..c0d9dd1c4f 100644 --- a/Samples/Work/Senparc.Weixin.Sample.Work/Senparc.Weixin.Sample.Work.net8.csproj +++ b/Samples/Work/Senparc.Weixin.Sample.Work/Senparc.Weixin.Sample.Work.net8.csproj @@ -25,9 +25,9 @@ - - - + + + diff --git a/Samples/WxOpen/Senparc.Weixin.Sample.WxOpen/Program.cs b/Samples/WxOpen/Senparc.Weixin.Sample.WxOpen/Program.cs index 30fef9f80a..44510f2862 100644 --- a/Samples/WxOpen/Senparc.Weixin.Sample.WxOpen/Program.cs +++ b/Samples/WxOpen/Senparc.Weixin.Sample.WxOpen/Program.cs @@ -1,3 +1,9 @@ +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using System.IO; + var builder = WebApplication.CreateBuilder(args); // Add services to the container. diff --git a/Samples/WxOpen/Senparc.Weixin.Sample.WxOpen/Senparc.Weixin.Sample.WxOpen.net8.csproj b/Samples/WxOpen/Senparc.Weixin.Sample.WxOpen/Senparc.Weixin.Sample.WxOpen.net8.csproj index 9b58186025..9a140031c1 100644 --- a/Samples/WxOpen/Senparc.Weixin.Sample.WxOpen/Senparc.Weixin.Sample.WxOpen.net8.csproj +++ b/Samples/WxOpen/Senparc.Weixin.Sample.WxOpen/Senparc.Weixin.Sample.WxOpen.net8.csproj @@ -25,10 +25,10 @@ - - - - + + + + diff --git a/Samples/sample-publish.bat b/Samples/sample-publish.bat new file mode 100644 index 0000000000..ff1bfc850a --- /dev/null +++ b/Samples/sample-publish.bat @@ -0,0 +1,21 @@ +@echo off +setlocal + +echo Publishing MP/Senparc.Weixin.Sample.MP/Senparc.Weixin.Sample.MP.net8.csproj... +dotnet publish MP/Senparc.Weixin.Sample.MP/Senparc.Weixin.Sample.MP.net8.csproj -o ./SamplePublish/MP + +echo Publishing TenPayV2/Senparc.Weixin.Sample.TenPayV2/Senparc.Weixin.Sample.TenPayV2.net8.csproj... +dotnet publish TenPayV2/Senparc.Weixin.Sample.TenPayV2/Senparc.Weixin.Sample.TenPayV2.net8.csproj -o ./SamplePublish/TenPayV2 + +echo Publishing TenPayV3/Senparc.Weixin.Sample.TenPayV3/Senparc.Weixin.Sample.TenPayV3.net8.csproj... +dotnet publish TenPayV3/Senparc.Weixin.Sample.TenPayV3/Senparc.Weixin.Sample.TenPayV3.net8.csproj -o ./SamplePublish/TenPayV3 + +echo Publishing Work/Senparc.Weixin.Sample.Work/Senparc.Weixin.Sample.Work.net8.csproj... +dotnet publish Work/Senparc.Weixin.Sample.Work/Senparc.Weixin.Sample.Work.net8.csproj -o ./SamplePublish/Work + +echo Publishing WxOpen/Senparc.Weixin.Sample.WxOpen/Senparc.Weixin.Sample.WxOpen.net8.csproj... +dotnet publish WxOpen/Senparc.Weixin.Sample.WxOpen/Senparc.Weixin.Sample.WxOpen.net8.csproj -o ./SamplePublish/WxOpen + +echo All projects have been published. +endlocal +pause \ No newline at end of file