mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-09-20 18:48:10 +08:00
chore(tenpayv3): 新增基于 .NET Framework 4.7 的示例项目
This commit is contained in:
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Sample_Net5.Services.HttpClients
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Sample.Services.HttpClients
|
||||
{
|
||||
public interface IWechatApiHttpClientFactory
|
||||
{
|
||||
|
@@ -1,13 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Flurl;
|
||||
using Flurl.Http;
|
||||
using Flurl.Http.Configuration;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Sample_Net5.Services.HttpClients.Implements
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Sample.Services.HttpClients.Implements
|
||||
{
|
||||
partial class WechatApiHttpClientFactory : IWechatApiHttpClientFactory
|
||||
{
|
||||
@@ -26,6 +24,10 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Sample_Net5.Services.HttpClients.Imple
|
||||
|
||||
public WechatApiClient Create(string appId)
|
||||
{
|
||||
// NOTICE:
|
||||
// 这里的工厂方法是为了演示多租户而存在的,可根据 AppId 生成不同的 API 客户端。
|
||||
// 如果你的项目只存在唯一一个租户,那么直接注入 `WechatApiClient` 即可。
|
||||
|
||||
var wechatAccountOptions = _wechatOptions.Accounts?.FirstOrDefault(e => string.Equals(appId, e.AppId));
|
||||
if (wechatAccountOptions == null)
|
||||
throw new Exception("未在配置项中找到该 AppId 对应的微信账号。");
|
||||
|
Reference in New Issue
Block a user