修改结构
This commit is contained in:
parent
c5866b5f83
commit
aac215643c
|
|
@ -20,6 +20,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AlibabaCloud.SDK.Cloudauth20190307" Version="3.3.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.10" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.10" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AlibabaCloud.SDK.Cloudauth20190307" Version="3.3.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.10" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="8.0.2" />
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CloudGaming.Test", "Console
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CloudGaming.PayApi", "Api\CloudGaming.PayApi\CloudGaming.PayApi.csproj", "{452D87B5-A7E0-4EBD-9CF2-1AFF5941065B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CloudGaming.AppConfigModel", "Model\CloudGaming.AppConfigModel\CloudGaming.AppConfigModel.csproj", "{58FD9A2F-E1FC-494C-9484-D5BCA8511EBE}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
|
@ -80,6 +82,10 @@ Global
|
|||
{452D87B5-A7E0-4EBD-9CF2-1AFF5941065B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{452D87B5-A7E0-4EBD-9CF2-1AFF5941065B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{452D87B5-A7E0-4EBD-9CF2-1AFF5941065B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{58FD9A2F-E1FC-494C-9484-D5BCA8511EBE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{58FD9A2F-E1FC-494C-9484-D5BCA8511EBE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{58FD9A2F-E1FC-494C-9484-D5BCA8511EBE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{58FD9A2F-E1FC-494C-9484-D5BCA8511EBE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
@ -94,6 +100,7 @@ Global
|
|||
{96CD0865-0AD5-41B3-89A2-374FF17CDD16} = {A3F00FB0-49D6-48B1-99D9-4619634DF8D9}
|
||||
{830841B9-E013-4FD5-8D31-D85545870C1C} = {9F7EF36C-17BB-4F93-927E-F462FE3C9337}
|
||||
{452D87B5-A7E0-4EBD-9CF2-1AFF5941065B} = {51CB40D2-99F5-43E8-95B4-3A75C91736A6}
|
||||
{58FD9A2F-E1FC-494C-9484-D5BCA8511EBE} = {A3F00FB0-49D6-48B1-99D9-4619634DF8D9}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {1D299D92-FA27-47A0-8D78-43D1FAFE7628}
|
||||
|
|
|
|||
|
|
@ -33,12 +33,12 @@ public class WeChatConfig
|
|||
public string NotifyUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// 微信支付序列号
|
||||
/// </summary>
|
||||
public string MerchantCertificateSerialNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// 微信支付私钥
|
||||
/// </summary>
|
||||
public string MerchantCertificatePrivateKey { get; set; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AgileConfig.Client" Version="1.7.3" />
|
||||
<PackageReference Include="AlibabaCloud.SDK.Cloudauth20190307" Version="3.2.0" />
|
||||
<PackageReference Include="AlibabaCloud.SDK.Cloudauth20190307" Version="3.3.0" />
|
||||
<PackageReference Include="AlibabaCloud.SDK.Dysmsapi20170525" Version="3.1.0" />
|
||||
<PackageReference Include="AlipayEasySDK" Version="2.1.3" />
|
||||
<PackageReference Include="AlipayEasySDK.Kernel" Version="1.0.6" />
|
||||
|
|
|
|||
|
|
@ -0,0 +1,68 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CloudGaming.AppConfigModel
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 阿里云配置
|
||||
/// </summary>
|
||||
public class AliyunConfig
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string AccessKeyId { get; set; }
|
||||
/// <summary>
|
||||
/// 配置环境变量
|
||||
/// </summary>
|
||||
public string AccessKeySecret { get; set; }
|
||||
|
||||
#region 阿里云OSS配置
|
||||
/// <summary>
|
||||
/// 替换为Bucket所在地域对应的Endpoint。以华东1(杭州)为例,Endpoint填写为https://oss-cn-hangzhou.aliyuncs.com。
|
||||
/// </summary>
|
||||
public string EndPoint { get; set; }
|
||||
/// <summary>
|
||||
/// Bucket名称。
|
||||
/// </summary>
|
||||
public string BucketName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上传路径
|
||||
/// </summary>
|
||||
public string UploadPath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 域名
|
||||
/// </summary>
|
||||
public string? DomainName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 前缀
|
||||
/// </summary>
|
||||
public string ImagePrefix
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.DomainName; //+ this.UploadPath
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 短信签名名称
|
||||
/// </summary>
|
||||
public string SmsSignName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// string 短信模板配置
|
||||
/// </summary>
|
||||
public string SmsTemplateCode { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
126
src/CloudGaming/Model/CloudGaming.AppConfigModel/AppConfig.cs
Normal file
126
src/CloudGaming/Model/CloudGaming.AppConfigModel/AppConfig.cs
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CloudGaming.AppConfigModel
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 项目配置
|
||||
/// </summary>
|
||||
public class AppConfig
|
||||
{
|
||||
public AppConfig() { }
|
||||
/// <summary>
|
||||
/// 用户数据库连接字符串
|
||||
/// </summary>
|
||||
public string UserConnectionString { get; set; }
|
||||
/// <summary>
|
||||
/// 游戏
|
||||
/// </summary>
|
||||
public string GameConnectionString { get; set; }
|
||||
/// <summary>
|
||||
/// 扩展
|
||||
/// </summary>
|
||||
public string ExtConnectionString { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 手机app配置
|
||||
/// </summary>
|
||||
public string PhoneConnectionString { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// redis连接字符串
|
||||
/// </summary>
|
||||
public string RedisConnectionString { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 域名
|
||||
/// </summary>
|
||||
public string DomainName { get; set; }
|
||||
/// <summary>
|
||||
/// 标识
|
||||
/// </summary>
|
||||
public string Identifier { get; set; }
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 默认语言
|
||||
/// </summary>
|
||||
public string DefaultLanguage { get; set; }
|
||||
/// <summary>
|
||||
/// 租户
|
||||
/// </summary>
|
||||
public Guid TenantId { get; set; }
|
||||
/// <summary>
|
||||
/// 项目支付数据
|
||||
/// </summary>
|
||||
public PaymentModel? Payment { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// oss阿里云配置
|
||||
/// </summary>
|
||||
public AliyunConfig AliyunConfig { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户默认配置
|
||||
/// </summary>
|
||||
public UserConfig UserConfig { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 游戏配置
|
||||
/// </summary>
|
||||
public GameConfig GameConfig { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取数据库连接字符串
|
||||
/// </summary>
|
||||
/// <param name="key">user,game,ext,phone</param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public string GetConnectionString(AppDataBaseType appDataBaseType)
|
||||
{
|
||||
switch (appDataBaseType)
|
||||
{
|
||||
case AppDataBaseType.User:
|
||||
return UserConnectionString;
|
||||
case AppDataBaseType.Game:
|
||||
return GameConnectionString;
|
||||
case AppDataBaseType.Ext:
|
||||
return ExtConnectionString;
|
||||
case AppDataBaseType.App:
|
||||
return PhoneConnectionString;
|
||||
default:
|
||||
throw new NotImplementedException("数据库连接字符串不存在");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 数据库选项
|
||||
/// </summary>
|
||||
|
||||
public enum AppDataBaseType
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户数据库
|
||||
/// </summary>
|
||||
User,
|
||||
/// <summary>
|
||||
/// 游戏数据库
|
||||
/// </summary>
|
||||
Game,
|
||||
/// <summary>
|
||||
/// 扩展数据库
|
||||
/// </summary>
|
||||
Ext,
|
||||
/// <summary>
|
||||
/// app数据库
|
||||
/// </summary>
|
||||
App
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AlibabaCloud.SDK.Cloudauth20190307" Version="3.3.0" />
|
||||
<PackageReference Include="AlipayEasySDK" Version="2.1.3" />
|
||||
<PackageReference Include="SKIT.FlurlHttpClient.Wechat.TenpayV3" Version="3.9.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CloudGaming.AppConfigModel
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class GameConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// 客户渠道Id,如:edb684859b848362ec56904286947614
|
||||
/// </summary>
|
||||
public string ChannelId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 客户渠道key,加密使用
|
||||
/// </summary>
|
||||
public string SignKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 客户渠道地址
|
||||
/// </summary>
|
||||
public string BsUrl { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
using Newtonsoft.Json;
|
||||
|
||||
using SKIT.FlurlHttpClient.Wechat.TenpayV3;
|
||||
using SKIT.FlurlHttpClient.Wechat.TenpayV3.Settings;
|
||||
namespace CloudGaming.AppConfigModel
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class PaymentModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 微信支付数据
|
||||
/// </summary>
|
||||
public WeChatConfig? WeChatConfig { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 支付宝支付数据
|
||||
/// </summary>
|
||||
public Alipay.EasySDK.Kernel.Config? AlipayConfig { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
private WechatTenpayClient _wxClient;
|
||||
/// <summary>
|
||||
/// 微信支付客户端
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public WechatTenpayClient? WxClient
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_wxClient == null)
|
||||
{
|
||||
if (WeChatConfig == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var manager = new InMemoryCertificateManager();
|
||||
/* 仅列出必须配置项。也包含一些诸如超时时间、UserAgent 等的配置项 */
|
||||
var wechatTenpayClientOptions = new WechatTenpayClientOptions()
|
||||
{
|
||||
|
||||
MerchantId = WeChatConfig.MchId,
|
||||
MerchantV3Secret = WeChatConfig.Key,
|
||||
MerchantCertificateSerialNumber = WeChatConfig.MerchantCertificateSerialNumber,
|
||||
MerchantCertificatePrivateKey = WeChatConfig.MerchantCertificatePrivateKey,
|
||||
PlatformCertificateManager = manager
|
||||
};
|
||||
_wxClient = new WechatTenpayClient(wechatTenpayClientOptions);
|
||||
}
|
||||
return _wxClient;
|
||||
}
|
||||
}
|
||||
|
||||
private Alipay.EasySDK.Kernel.Context _aliPayContext;
|
||||
/// <summary>
|
||||
/// 支付宝支付
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public Alipay.EasySDK.Kernel.Context AliPayContext
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_aliPayContext == null)
|
||||
{
|
||||
if (AlipayConfig != null)
|
||||
{
|
||||
_aliPayContext = new Alipay.EasySDK.Kernel.Context(AlipayConfig, "alipay-easysdk-net-2.1.0");
|
||||
}
|
||||
}
|
||||
return _aliPayContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CloudGaming.AppConfigModel
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 用户默认配置
|
||||
/// </summary>
|
||||
public class UserConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户默认头像
|
||||
/// </summary>
|
||||
public string UserIconUrl { get; set; }
|
||||
/// <summary>
|
||||
/// 用户默认昵称
|
||||
/// </summary>
|
||||
public string NickName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户最大登录设备
|
||||
/// </summary>
|
||||
public int MaxDeviceCount { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CloudGaming.AppConfigModel
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class WeChatConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// appId
|
||||
/// </summary>
|
||||
public string AppId { get; set; }
|
||||
/// <summary>
|
||||
/// appkey
|
||||
/// </summary>
|
||||
public string AppSecret { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Key { get; set; }
|
||||
/// <summary>
|
||||
/// 商户id
|
||||
/// </summary>
|
||||
public string MchId { get; set; }
|
||||
/// <summary>
|
||||
/// 回调地址
|
||||
/// </summary>
|
||||
public string NotifyUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 微信支付序列号
|
||||
/// </summary>
|
||||
public string MerchantCertificateSerialNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 微信支付私钥
|
||||
/// </summary>
|
||||
public string MerchantCertificatePrivateKey { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user