mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-09-19 18:22:24 +08:00
chore(tenpayv3): 新增基于 .NET Framework 4.7 的示例项目
This commit is contained in:
@@ -6,11 +6,12 @@ using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using SKIT.FlurlHttpClient.Wechat.Api;
|
||||
using SKIT.FlurlHttpClient.Wechat.Api.Models;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Sample_Net5.Services.BackgroundServices
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Sample.Services.BackgroundServices
|
||||
{
|
||||
using SKIT.FlurlHttpClient.Wechat.Api;
|
||||
using SKIT.FlurlHttpClient.Wechat.Api.Models;
|
||||
|
||||
class WechatAccessTokenRefreshingBackgroundService : BackgroundService
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
|
@@ -1,10 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Medallion.Threading;
|
||||
using Medallion.Threading;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Sample_Net5.Services.DistributedLock
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Sample.Services.DistributedLock
|
||||
{
|
||||
public interface IDistributedLockFactory
|
||||
{
|
||||
|
@@ -1,12 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Medallion.Threading;
|
||||
using Medallion.Threading.FileSystem;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Sample_Net5.Services.DistributedLock.Implements
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Sample.Services.DistributedLock.Implements
|
||||
{
|
||||
class DistributedLockFactory : IDistributedLockFactory
|
||||
{
|
||||
@@ -14,7 +11,9 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Sample_Net5.Services.DistributedLock.I
|
||||
|
||||
public IDistributedLock Create(string lockName)
|
||||
{
|
||||
// NOTICE: 单机演示基于文件实现分布式锁,生产项目请替换成其他实现
|
||||
// NOTICE:
|
||||
// 单机演示基于文件实现分布式锁,生产项目请替换成其他实现。
|
||||
|
||||
return new FileDistributedLock(_lockFileDirectory, lockName);
|
||||
}
|
||||
}
|
||||
|
@@ -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 对应的微信账号。");
|
||||
|
@@ -1,10 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Sample_Net5.Services.Repositories
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Sample.Services.Repositories
|
||||
{
|
||||
public interface IWechatAccessTokenEntityRepository : IEnumerable<Models.WechatAccessTokenEntity>
|
||||
{
|
||||
|
@@ -1,11 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using NMemory;
|
||||
using NMemory;
|
||||
using NMemory.Tables;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Sample_Net5.Services.Repositories.Implements
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Sample.Services.Repositories.Implements
|
||||
{
|
||||
internal class GlobalDatabase
|
||||
{
|
||||
|
@@ -1,10 +1,8 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Sample_Net5.Services.Repositories.Implements
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Sample.Services.Repositories.Implements
|
||||
{
|
||||
public class WechatAccessTokenEntityRepository : IWechatAccessTokenEntityRepository
|
||||
{
|
||||
|
Reference in New Issue
Block a user