Skip to content

Commit

Permalink
更新 Sample,批处理发布单个模块的 Sample
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffreySu committed Dec 18, 2024
1 parent ad602f1 commit fe66683
Show file tree
Hide file tree
Showing 19 changed files with 55 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +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/TenPayV3/net8.0
/Samples/SamplePublish/
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

//转发到朋友圈
Expand Down
2 changes: 1 addition & 1 deletion Samples/MP/Senparc.Weixin.Sample.MP.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

<!-- 此节点为 Sample 共享文件需要而添加,实际项目无需添加 -->
<GenerateEmbeddedFilesManifest Condition=" '$(Configuration)' != 'Release' ">true</GenerateEmbeddedFilesManifest>
<OutputPath Condition=" '$(Configuration)' = 'Release' ">$(SolutionDir)\..\..\SamplePublish\MP</OutputPath>
</PropertyGroup>

<!-- 此节点为 Sample 共享文件需要而添加,实际项目无需添加 -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

//转发到朋友圈
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
4 changes: 3 additions & 1 deletion Samples/TenPayV2/Senparc.Weixin.Sample.TenPayV2/Program.cs
Original file line number Diff line number Diff line change
@@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

<!-- 此节点为 Sample 共享文件需要而添加,实际项目无需添加 -->
<GenerateEmbeddedFilesManifest Condition=" '$(Configuration)' != 'Release' ">true</GenerateEmbeddedFilesManifest>
<OutputPath Condition=" '$(Configuration)' == 'Release' ">$(SolutionDir)\..\SamplePublish\TenPayV2</OutputPath>
</PropertyGroup>

<!-- 此节点为 Sample 共享文件需要而添加,实际项目无需添加 -->
Expand Down
8 changes: 7 additions & 1 deletion Samples/TenPayV3/Senparc.Weixin.Sample.TenPayV3/Program.cs
Original file line number Diff line number Diff line change
@@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

<!-- 此节点为 Sample 共享文件需要而添加,实际项目无需添加 -->
<GenerateEmbeddedFilesManifest Condition=" '$(Configuration)' != 'Release' ">true</GenerateEmbeddedFilesManifest>
<OutputPath Condition=" '$(Configuration)' == 'Release' ">$(SolutionDir)\..\SamplePublish\TenPayV3</OutputPath>
</PropertyGroup>

<!-- 此节点为 Sample 共享文件需要而添加,实际项目无需添加 -->
Expand Down
5 changes: 5 additions & 0 deletions Samples/Work/Senparc.Weixin.Sample.Work/Program.cs
Original file line number Diff line number Diff line change
@@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

<!-- 此节点为 Sample 共享文件需要而添加,实际项目无需添加 -->
<GenerateEmbeddedFilesManifest Condition=" '$(Configuration)' != 'Release' ">true</GenerateEmbeddedFilesManifest>
<OutputPath Condition=" '$(Configuration)' == 'Release' ">$(SolutionDir)\..\SamplePublish\Work</OutputPath>
</PropertyGroup>

<!-- 此节点为 Sample 共享文件需要而添加,实际项目无需添加 -->
Expand Down
6 changes: 6 additions & 0 deletions Samples/WxOpen/Senparc.Weixin.Sample.WxOpen/Program.cs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

<!-- 此节点为 Sample 共享文件需要而添加,实际项目无需添加 -->
<GenerateEmbeddedFilesManifest Condition=" '$(Configuration)' != 'Release' ">true</GenerateEmbeddedFilesManifest>
<OutputPath Condition=" '$(Configuration)' == 'Release' ">$(SolutionDir)\..\SamplePublish\WxOpen</OutputPath>
</PropertyGroup>

<!-- 此节点为 Sample 共享文件需要而添加,实际项目无需添加 -->
Expand Down
19 changes: 12 additions & 7 deletions Samples/sample-publish.bat
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
@echo off
setlocal

echo Publishing MP/Senparc.Weixin.Sample.MP...
dotnet publish MP/Senparc.Weixin.Sample.MP
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

set ProjectFolders=(TenPayV2, TenPayV3, WxOpen)
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

for %%F in %ProjectFolders% do (
echo Publishing %%F...
dotnet publish %%F
)
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
Expand Down

0 comments on commit fe66683

Please sign in to comment.