-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2608 from JeffreySu/Developer
Developer
- Loading branch information
Showing
67 changed files
with
1,883 additions
and
225 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
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}" | ||
EndProject | ||
Global | ||
GlobalSection(SharedMSBuildProjectFiles) = preSolution | ||
..\Shared\Senparc.Weixin.Sample.Shared\Senparc.Weixin.Sample.Shared.projitems*{99eeb8cc-fe5e-4a1d-80c2-9a0c1fa757bd}*SharedItemsImports = 5 | ||
EndGlobalSection | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{99EEB8CC-FE5E-4A1D-80C2-9A0C1FA757BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{99EEB8CC-FE5E-4A1D-80C2-9A0C1FA757BD}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{99EEB8CC-FE5E-4A1D-80C2-9A0C1FA757BD}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{99EEB8CC-FE5E-4A1D-80C2-9A0C1FA757BD}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {34AD62B8-CE7D-43AB-82FD-C46CBB2A6E76} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
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.TenPayV2", "Senparc.Weixin.Sample.TenPayV2\Senparc.Weixin.Sample.TenPayV2.csproj", "{0FA694CF-308E-4763-AC3A-5799BFD20068}" | ||
EndProject | ||
Global | ||
GlobalSection(SharedMSBuildProjectFiles) = preSolution | ||
..\Shared\Senparc.Weixin.Sample.Shared\Senparc.Weixin.Sample.Shared.projitems*{0fa694cf-308e-4763-ac3a-5799bfd20068}*SharedItemsImports = 5 | ||
EndGlobalSection | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{0FA694CF-308E-4763-AC3A-5799BFD20068}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{0FA694CF-308E-4763-AC3A-5799BFD20068}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{0FA694CF-308E-4763-AC3A-5799BFD20068}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{0FA694CF-308E-4763-AC3A-5799BFD20068}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {64CCB121-C5D5-4198-9F2C-949829F1828A} | ||
EndGlobalSection | ||
EndGlobal |
12 changes: 12 additions & 0 deletions
12
Samples/TenPayV2/Senparc.Weixin.Sample.TenPayV2/.config/dotnet-tools.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"version": 1, | ||
"isRoot": true, | ||
"tools": { | ||
"dotnet-ef": { | ||
"version": "6.0.2", | ||
"commands": [ | ||
"dotnet-ef" | ||
] | ||
} | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
Samples/TenPayV2/Senparc.Weixin.Sample.TenPayV2/Controllers/BaseController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/*---------------------------------------------------------------- | ||
Copyright (C) 2022 Senparc | ||
文件名:BaseController.cs | ||
文件功能描述:Controller基类 | ||
创建标识:Senparc - 20150312 | ||
----------------------------------------------------------------*/ | ||
|
||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.Filters; | ||
using Senparc.Weixin.Entities; | ||
|
||
namespace Senparc.Weixin.Sample.TenPayV2.Controllers | ||
{ | ||
public class BaseController : Controller | ||
{ | ||
protected string AppId | ||
{ | ||
get | ||
{ | ||
return Config.SenparcWeixinSetting.WeixinAppId;//与微信公众账号后台的AppId设置保持一致,区分大小写。 | ||
} | ||
} | ||
|
||
protected static ISenparcWeixinSettingForMP MpSetting | ||
{ | ||
get | ||
{ | ||
return Config.SenparcWeixinSetting.MpSetting; | ||
} | ||
} | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
Samples/TenPayV2/Senparc.Weixin.Sample.TenPayV2/Controllers/HomeController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using Senparc.Weixin.Sample.Models; | ||
using System.Diagnostics; | ||
|
||
namespace Senparc.Weixin.Sample.TenPayV2.Controllers | ||
{ | ||
public class HomeController : BaseController | ||
{ | ||
private readonly ILogger<HomeController> _logger; | ||
|
||
public HomeController(ILogger<HomeController> logger) | ||
{ | ||
_logger = logger; | ||
} | ||
|
||
public IActionResult Index() | ||
{ | ||
return View(); | ||
} | ||
|
||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] | ||
public IActionResult Error() | ||
{ | ||
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
Samples/TenPayV2/Senparc.Weixin.Sample.TenPayV2/GlobalUsing.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
global using Senparc.NeuChar.MessageHandlers; | ||
global using Senparc.Weixin.AspNet; | ||
global using Senparc.Weixin.MP; | ||
global using Senparc.Weixin.TenPay; | ||
global using Senparc.Weixin.RegisterServices; | ||
global using Senparc.Weixin.Sample.TenPayV2; | ||
global using Microsoft.Extensions.Options; | ||
global using Senparc.Weixin.Entities; | ||
global using Microsoft.Extensions.FileProviders; |
74 changes: 74 additions & 0 deletions
74
Samples/TenPayV2/Senparc.Weixin.Sample.TenPayV2/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
|
||
var builder = WebApplication.CreateBuilder(args); | ||
|
||
// Add services to the container. | ||
builder.Services.AddControllersWithViews(); | ||
|
||
#region 添加微信配置 | ||
|
||
//使用本地缓存必须添加 | ||
builder.Services.AddMemoryCache(); | ||
|
||
//Senparc.Weixin 注册(必须) | ||
builder.Services.AddSenparcWeixinServices(builder.Configuration); | ||
|
||
#endregion | ||
|
||
var app = builder.Build(); | ||
|
||
#region 启用微信配置 | ||
|
||
var senparcWeixinSetting = app.Services.GetService<IOptions<SenparcWeixinSetting>>()!.Value; | ||
|
||
//启用微信配置(必须) | ||
var registerService = app.UseSenparcWeixin(app.Environment, | ||
null /* 不为 null 则覆盖 appsettings 中的 SenpacSetting 配置*/, | ||
null /* 不为 null 则覆盖 appsettings 中的 SenpacWeixinSetting 配置*/, | ||
register => { /* CO2NET 全局配置 */ }, | ||
(register, weixinSetting) => | ||
{ | ||
//注册公众号信息(可以执行多次,注册多个公众号) | ||
register.RegisterMpAccount(weixinSetting, "【盛派网络小助手】公众号"); | ||
//注册微信支付(可以执行多次,注册多个微信支付) | ||
register.RegisterTenpayOld(weixinSetting, "【盛派网络小助手】微信支付(V2)"); | ||
}); | ||
|
||
#endregion | ||
|
||
// Configure the HTTP request pipeline. | ||
if (!app.Environment.IsDevelopment()) | ||
{ | ||
app.UseExceptionHandler("/Home/Error"); | ||
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. | ||
app.UseHsts(); | ||
} | ||
|
||
app.UseHttpsRedirection(); | ||
app.UseStaticFiles(); | ||
|
||
#region 此部分代码为 Sample 共享文件需要而添加,实际项目无需添加 | ||
#if DEBUG | ||
//app.UseStaticFiles(new StaticFileOptions | ||
//{ | ||
// FileProvider = new ManifestEmbeddedFileProvider(Assembly.GetExecutingAssembly(), "wwwroot"), | ||
// RequestPath = new PathString("") | ||
//}); | ||
|
||
app.UseStaticFiles(new StaticFileOptions | ||
{ | ||
FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), @"..", "..", "Shared", "Senparc.Weixin.Sample.Shared", "wwwroot")), | ||
RequestPath = new PathString("") | ||
}); | ||
#endif | ||
#endregion | ||
|
||
|
||
app.UseRouting(); | ||
|
||
app.UseAuthorization(); | ||
|
||
app.MapControllerRoute( | ||
name: "default", | ||
pattern: "{controller=Home}/{action=Index}/{id?}"); | ||
|
||
app.Run(); |
16 changes: 16 additions & 0 deletions
16
...s/TenPayV2/Senparc.Weixin.Sample.TenPayV2/Properties/PublishProfiles/FolderProfile.pubxml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
https://go.microsoft.com/fwlink/?LinkID=208121. | ||
--> | ||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<DeleteExistingFiles>False</DeleteExistingFiles> | ||
<ExcludeApp_Data>False</ExcludeApp_Data> | ||
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish> | ||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration> | ||
<LastUsedPlatform>Any CPU</LastUsedPlatform> | ||
<PublishProvider>FileSystem</PublishProvider> | ||
<PublishUrl>bin\publish\</PublishUrl> | ||
<WebPublishMethod>FileSystem</WebPublishMethod> | ||
</PropertyGroup> | ||
</Project> |
28 changes: 28 additions & 0 deletions
28
Samples/TenPayV2/Senparc.Weixin.Sample.TenPayV2/Properties/launchSettings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"iisSettings": { | ||
"windowsAuthentication": false, | ||
"anonymousAuthentication": true, | ||
"iisExpress": { | ||
"applicationUrl": "http://localhost:17965", | ||
"sslPort": 44365 | ||
} | ||
}, | ||
"profiles": { | ||
"Senparc.Weixin.Sample.MP": { | ||
"commandName": "Project", | ||
"dotnetRunMessages": true, | ||
"launchBrowser": true, | ||
"applicationUrl": "https://localhost:7065;http://localhost:5065", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
} | ||
}, | ||
"IIS Express": { | ||
"commandName": "IISExpress", | ||
"launchBrowser": true, | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.