diff --git a/aspnet-core/LINGYUN.MicroService.All.sln b/aspnet-core/LINGYUN.MicroService.All.sln
index cd76d0186..d8dc50f2d 100644
--- a/aspnet-core/LINGYUN.MicroService.All.sln
+++ b/aspnet-core/LINGYUN.MicroService.All.sln
@@ -380,6 +380,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.BlobStoring.Ten
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.OssManagement.Tencent", "modules\oss-management\LINGYUN.Abp.OssManagement.Tencent\LINGYUN.Abp.OssManagement.Tencent.csproj", "{31E60E23-FD98-4D5E-A137-2B3F2968BA09}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.IdentityServer.LinkUser", "modules\identityServer\LINGYUN.Abp.IdentityServer.LinkUser\LINGYUN.Abp.IdentityServer.LinkUser.csproj", "{25378F9D-2A66-4568-AAC6-E9282ACA3DD3}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.IdentityServer.QQ", "modules\identityServer\LINGYUN.Abp.IdentityServer.QQ\LINGYUN.Abp.IdentityServer.QQ.csproj", "{A34CCD3F-28A1-4BAD-A995-EB8720CE4105}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Tencent.QQ", "modules\cloud-tencent\LINGYUN.Abp.Tencent.QQ\LINGYUN.Abp.Tencent.QQ.csproj", "{3FCB1BCD-34BC-4F66-968F-38DB28371D0F}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -982,6 +988,18 @@ Global
{31E60E23-FD98-4D5E-A137-2B3F2968BA09}.Debug|Any CPU.Build.0 = Debug|Any CPU
{31E60E23-FD98-4D5E-A137-2B3F2968BA09}.Release|Any CPU.ActiveCfg = Release|Any CPU
{31E60E23-FD98-4D5E-A137-2B3F2968BA09}.Release|Any CPU.Build.0 = Release|Any CPU
+ {25378F9D-2A66-4568-AAC6-E9282ACA3DD3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {25378F9D-2A66-4568-AAC6-E9282ACA3DD3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {25378F9D-2A66-4568-AAC6-E9282ACA3DD3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {25378F9D-2A66-4568-AAC6-E9282ACA3DD3}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A34CCD3F-28A1-4BAD-A995-EB8720CE4105}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A34CCD3F-28A1-4BAD-A995-EB8720CE4105}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A34CCD3F-28A1-4BAD-A995-EB8720CE4105}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A34CCD3F-28A1-4BAD-A995-EB8720CE4105}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3FCB1BCD-34BC-4F66-968F-38DB28371D0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3FCB1BCD-34BC-4F66-968F-38DB28371D0F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3FCB1BCD-34BC-4F66-968F-38DB28371D0F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3FCB1BCD-34BC-4F66-968F-38DB28371D0F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -1167,6 +1185,9 @@ Global
{8FE2725C-6829-4778-93BA-A53260697AFB} = {3B96F4D8-4993-419B-BCEB-AFE4ED39449F}
{A4B972EC-9F0B-4405-9965-766FABC9B07E} = {3B96F4D8-4993-419B-BCEB-AFE4ED39449F}
{31E60E23-FD98-4D5E-A137-2B3F2968BA09} = {B05CB08F-C088-4D6D-97EE-A94A5D1AE4A6}
+ {25378F9D-2A66-4568-AAC6-E9282ACA3DD3} = {0439B173-F41E-4CE0-A44A-CCB70328F272}
+ {A34CCD3F-28A1-4BAD-A995-EB8720CE4105} = {0439B173-F41E-4CE0-A44A-CCB70328F272}
+ {3FCB1BCD-34BC-4F66-968F-38DB28371D0F} = {3B96F4D8-4993-419B-BCEB-AFE4ED39449F}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C95FDF91-16F2-4A8B-A4BE-0E62D1B66718}
diff --git a/aspnet-core/modules/cloud-aliyun/LINGYUN.Abp.Aliyun.SettingManagement/LINGYUN/Abp/Aliyun/SettingManagement/AliyunSettingAppService.cs b/aspnet-core/modules/cloud-aliyun/LINGYUN.Abp.Aliyun.SettingManagement/LINGYUN/Abp/Aliyun/SettingManagement/AliyunSettingAppService.cs
index 945b68a9f..31cce24d9 100644
--- a/aspnet-core/modules/cloud-aliyun/LINGYUN.Abp.Aliyun.SettingManagement/LINGYUN/Abp/Aliyun/SettingManagement/AliyunSettingAppService.cs
+++ b/aspnet-core/modules/cloud-aliyun/LINGYUN.Abp.Aliyun.SettingManagement/LINGYUN/Abp/Aliyun/SettingManagement/AliyunSettingAppService.cs
@@ -1,7 +1,6 @@
using LINGYUN.Abp.Aliyun.Localization;
using LINGYUN.Abp.Aliyun.Settings;
using LINGYUN.Abp.SettingManagement;
-using LINGYUN.Abp.Sms.Aliyun.Settings;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
using Volo.Abp.Authorization.Permissions;
@@ -106,45 +105,45 @@ namespace LINGYUN.Abp.Aliyun.SettingManagement
var smsSetting = aliyunSettingGroup.AddSetting(L["DisplayName:Aliyun.Sms"], L["Description:Aliyun.Sms"]);
smsSetting.AddDetail(
- SettingDefinitionManager.Get(AliyunSmsSettingNames.Sms.Domain),
+ SettingDefinitionManager.Get(AliyunSettingNames.Sms.Domain),
StringLocalizerFactory,
- await SettingManager.GetOrNullAsync(AliyunSmsSettingNames.Sms.Domain, providerName, providerKey),
+ await SettingManager.GetOrNullAsync(AliyunSettingNames.Sms.Domain, providerName, providerKey),
ValueType.String,
providerName);
smsSetting.AddDetail(
- SettingDefinitionManager.Get(AliyunSmsSettingNames.Sms.Version),
+ SettingDefinitionManager.Get(AliyunSettingNames.Sms.Version),
StringLocalizerFactory,
- await SettingManager.GetOrNullAsync(AliyunSmsSettingNames.Sms.Version, providerName, providerKey),
+ await SettingManager.GetOrNullAsync(AliyunSettingNames.Sms.Version, providerName, providerKey),
ValueType.String,
providerName);
smsSetting.AddDetail(
- SettingDefinitionManager.Get(AliyunSmsSettingNames.Sms.ActionName),
+ SettingDefinitionManager.Get(AliyunSettingNames.Sms.ActionName),
StringLocalizerFactory,
- await SettingManager.GetOrNullAsync(AliyunSmsSettingNames.Sms.ActionName, providerName, providerKey),
+ await SettingManager.GetOrNullAsync(AliyunSettingNames.Sms.ActionName, providerName, providerKey),
ValueType.String,
providerName);
smsSetting.AddDetail(
- SettingDefinitionManager.Get(AliyunSmsSettingNames.Sms.DefaultPhoneNumber),
+ SettingDefinitionManager.Get(AliyunSettingNames.Sms.DefaultPhoneNumber),
StringLocalizerFactory,
- await SettingManager.GetOrNullAsync(AliyunSmsSettingNames.Sms.DefaultPhoneNumber, providerName, providerKey),
+ await SettingManager.GetOrNullAsync(AliyunSettingNames.Sms.DefaultPhoneNumber, providerName, providerKey),
ValueType.String,
providerName);
smsSetting.AddDetail(
- SettingDefinitionManager.Get(AliyunSmsSettingNames.Sms.DefaultSignName),
+ SettingDefinitionManager.Get(AliyunSettingNames.Sms.DefaultSignName),
StringLocalizerFactory,
- await SettingManager.GetOrNullAsync(AliyunSmsSettingNames.Sms.DefaultSignName, providerName, providerKey),
+ await SettingManager.GetOrNullAsync(AliyunSettingNames.Sms.DefaultSignName, providerName, providerKey),
ValueType.String,
providerName);
smsSetting.AddDetail(
- SettingDefinitionManager.Get(AliyunSmsSettingNames.Sms.DefaultTemplateCode),
+ SettingDefinitionManager.Get(AliyunSettingNames.Sms.DefaultTemplateCode),
StringLocalizerFactory,
- await SettingManager.GetOrNullAsync(AliyunSmsSettingNames.Sms.DefaultTemplateCode, providerName, providerKey),
+ await SettingManager.GetOrNullAsync(AliyunSettingNames.Sms.DefaultTemplateCode, providerName, providerKey),
ValueType.String,
providerName);
smsSetting.AddDetail(
- SettingDefinitionManager.Get(AliyunSmsSettingNames.Sms.VisableErrorToClient),
+ SettingDefinitionManager.Get(AliyunSettingNames.Sms.VisableErrorToClient),
StringLocalizerFactory,
- await SettingManager.GetOrNullAsync(AliyunSmsSettingNames.Sms.VisableErrorToClient, providerName, providerKey),
+ await SettingManager.GetOrNullAsync(AliyunSettingNames.Sms.VisableErrorToClient, providerName, providerKey),
ValueType.Boolean,
providerName);
diff --git a/aspnet-core/modules/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN/Abp/Aliyun/Localization/Resources/en.json b/aspnet-core/modules/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN/Abp/Aliyun/Localization/Resources/en.json
index c2ec27158..6a5367804 100644
--- a/aspnet-core/modules/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN/Abp/Aliyun/Localization/Resources/en.json
+++ b/aspnet-core/modules/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN/Abp/Aliyun/Localization/Resources/en.json
@@ -20,6 +20,22 @@
"DisplayName:DurationSeconds": "Duration Seconds,in seconds",
"Description:DurationSeconds": "Duration Seconds,in seconds",
"DisplayName:Policy": "Policy",
- "Description:Policy": "Policy"
+ "Description:Policy": "Policy",
+ "DisplayName:Aliyun.Sms": "Sms",
+ "Description:Aliyun.Sms": "Sms",
+ "DisplayName:ActionName": "Action Name",
+ "Description:ActionName": "Action Name",
+ "DisplayName:DefaultSignName": "Default Sign Name",
+ "Description:DefaultSignName": "Default Sign Name",
+ "DisplayName:DefaultTemplateCode": "Default Template Code",
+ "Description:DefaultTemplateCode": "Default Template Code",
+ "DisplayName:DefaultPhoneNumber": "Default Phone Number",
+ "Description:DefaultPhoneNumber": "Default Phone Number",
+ "DisplayName:Domain": "Domain",
+ "Description:Domain": "Domain",
+ "DisplayName:Version": "Version",
+ "Description:Version": "Version",
+ "DisplayName:VisableErrorToClient": "Visable Error To Client",
+ "Description:VisableErrorToClient": "Visable Error To Client"
}
}
\ No newline at end of file
diff --git a/aspnet-core/modules/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN/Abp/Aliyun/Localization/Resources/zh-Hans.json b/aspnet-core/modules/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN/Abp/Aliyun/Localization/Resources/zh-Hans.json
index 0554c335c..a91311318 100644
--- a/aspnet-core/modules/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN/Abp/Aliyun/Localization/Resources/zh-Hans.json
+++ b/aspnet-core/modules/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN/Abp/Aliyun/Localization/Resources/zh-Hans.json
@@ -20,6 +20,22 @@
"DisplayName:DurationSeconds": "过期时间,单位为秒。",
"Description:DurationSeconds": "过期时间最小值为900秒,默认3600秒",
"DisplayName:Policy": "权限策略",
- "Description:Policy": "生成STS Token时可以指定一个额外的权限策略,以进一步限制STS Token的权限"
+ "Description:Policy": "生成STS Token时可以指定一个额外的权限策略,以进一步限制STS Token的权限",
+ "DisplayName:Aliyun.Sms": "短信服务",
+ "Description:Aliyun.Sms": "阿里云短信服务",
+ "DisplayName:ActionName": "发送短信方法",
+ "Description:ActionName": "发送短信方法名称,详情见阿里云Sms服务",
+ "DisplayName:DefaultSignName": "默认短信签名",
+ "Description:DefaultSignName": "当用户未指定短信签名时的默认签名名称",
+ "DisplayName:DefaultTemplateCode": "默认短信模板号",
+ "Description:DefaultTemplateCode": "当用户未指定短信签名时的默认短信模板号",
+ "DisplayName:DefaultPhoneNumber": "默认接收短信手机号",
+ "Description:DefaultPhoneNumber": "当用户未指定短信接收方时的默认接收手机号码",
+ "DisplayName:Domain": "阿里云sms服务域名",
+ "Description:Domain": "阿里云sms服务域名",
+ "DisplayName:Version": "阿里云sms服务版本号",
+ "Description:Version": "阿里云sms服务版本号",
+ "DisplayName:VisableErrorToClient": "发送错误到客户端",
+ "Description:VisableErrorToClient": "当短信服务发送出现错误时是否发送错误详情到客户端"
}
}
\ No newline at end of file
diff --git a/aspnet-core/modules/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN/Abp/Aliyun/Settings/AliyunSettingNames.cs b/aspnet-core/modules/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN/Abp/Aliyun/Settings/AliyunSettingNames.cs
index 9bbd67fb2..fef2a1af2 100644
--- a/aspnet-core/modules/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN/Abp/Aliyun/Settings/AliyunSettingNames.cs
+++ b/aspnet-core/modules/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN/Abp/Aliyun/Settings/AliyunSettingNames.cs
@@ -43,5 +43,41 @@
///
public const string Policy = Prefix + ".Policy";
}
+
+ ///
+ /// 短信服务
+ ///
+ public class Sms
+ {
+ public const string Prefix = AliyunSettingNames.Prefix + ".Sms";
+ ///
+ /// 阿里云sms服务域名
+ ///
+ public const string Domain = Prefix + ".Domain";
+ ///
+ /// 调用方法名称
+ ///
+ public const string ActionName = Prefix + ".ActionName";
+ ///
+ /// 默认版本号
+ ///
+ public const string Version = Prefix + ".Version";
+ ///
+ /// 默认签名
+ ///
+ public const string DefaultSignName = Prefix + ".DefaultSignName";
+ ///
+ /// 默认短信模板号
+ ///
+ public const string DefaultTemplateCode = Prefix + ".DefaultTemplateCode";
+ ///
+ /// 默认号码
+ ///
+ public const string DefaultPhoneNumber = Prefix + ".DefaultPhoneNumber";
+ ///
+ /// 展示错误给客户端
+ ///
+ public const string VisableErrorToClient = Prefix + ".VisableErrorToClient";
+ }
}
}
diff --git a/aspnet-core/modules/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN/Abp/Aliyun/Settings/AliyunSettingProvider.cs b/aspnet-core/modules/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN/Abp/Aliyun/Settings/AliyunSettingProvider.cs
index f8ef3d104..540af9775 100644
--- a/aspnet-core/modules/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN/Abp/Aliyun/Settings/AliyunSettingProvider.cs
+++ b/aspnet-core/modules/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN/Abp/Aliyun/Settings/AliyunSettingProvider.cs
@@ -8,10 +8,11 @@ namespace LINGYUN.Abp.Aliyun.Settings
{
public override void Define(ISettingDefinitionContext context)
{
- context.Add(CreateAliyunSettings());
+ context.Add(GetAuthorizationSettings());
+ context.Add(GetSmsSettings());
}
- private SettingDefinition[] CreateAliyunSettings()
+ private SettingDefinition[] GetAuthorizationSettings()
{
return new SettingDefinition[]
{
@@ -113,6 +114,95 @@ namespace LINGYUN.Abp.Aliyun.Settings
};
}
+ private SettingDefinition[] GetSmsSettings()
+ {
+ return new SettingDefinition[]
+ {
+ new SettingDefinition(
+ AliyunSettingNames.Sms.ActionName,
+ defaultValue: "SendSms",
+ displayName: L("DisplayName:ActionName"),
+ description: L("Description:ActionName"),
+ isVisibleToClients: false
+ )
+ .WithProviders(
+ DefaultValueSettingValueProvider.ProviderName,
+ ConfigurationSettingValueProvider.ProviderName,
+ GlobalSettingValueProvider.ProviderName,
+ TenantSettingValueProvider.ProviderName),
+ new SettingDefinition(
+ AliyunSettingNames.Sms.DefaultSignName,
+ displayName: L("DisplayName:DefaultSignName"),
+ description: L("Description:DefaultSignName"),
+ isVisibleToClients: false,
+ isEncrypted: true
+ )
+ .WithProviders(
+ DefaultValueSettingValueProvider.ProviderName,
+ ConfigurationSettingValueProvider.ProviderName,
+ GlobalSettingValueProvider.ProviderName,
+ TenantSettingValueProvider.ProviderName),
+ new SettingDefinition(
+ AliyunSettingNames.Sms.DefaultTemplateCode,
+ displayName: L("DisplayName:DefaultTemplateCode"),
+ description: L("Description:DefaultTemplateCode"),
+ isVisibleToClients: false,
+ isEncrypted: true
+ )
+ .WithProviders(
+ DefaultValueSettingValueProvider.ProviderName,
+ ConfigurationSettingValueProvider.ProviderName,
+ GlobalSettingValueProvider.ProviderName,
+ TenantSettingValueProvider.ProviderName),
+ new SettingDefinition(
+ AliyunSettingNames.Sms.DefaultPhoneNumber,
+ displayName: L("DisplayName:DefaultPhoneNumber"),
+ description: L("Description:DefaultPhoneNumber"),
+ isVisibleToClients: false
+ )
+ .WithProviders(
+ DefaultValueSettingValueProvider.ProviderName,
+ ConfigurationSettingValueProvider.ProviderName,
+ GlobalSettingValueProvider.ProviderName,
+ TenantSettingValueProvider.ProviderName),
+ new SettingDefinition(
+ AliyunSettingNames.Sms.Domain,
+ defaultValue: "dysmsapi.aliyuncs.com",
+ displayName: L("DisplayName:Domain"),
+ description: L("Description:Domain"),
+ isVisibleToClients: false
+ )
+ .WithProviders(
+ DefaultValueSettingValueProvider.ProviderName,
+ ConfigurationSettingValueProvider.ProviderName,
+ GlobalSettingValueProvider.ProviderName,
+ TenantSettingValueProvider.ProviderName),
+ new SettingDefinition(
+ AliyunSettingNames.Sms.Version,
+ defaultValue: "2017-05-25",
+ displayName: L("DisplayName:Version"),
+ description: L("Description:Version"),
+ isVisibleToClients: false
+ )
+ .WithProviders(
+ DefaultValueSettingValueProvider.ProviderName,
+ ConfigurationSettingValueProvider.ProviderName,
+ GlobalSettingValueProvider.ProviderName,
+ TenantSettingValueProvider.ProviderName),
+ new SettingDefinition(
+ AliyunSettingNames.Sms.VisableErrorToClient,
+ defaultValue: false.ToString(),
+ displayName: L("DisplayName:VisableErrorToClient"),
+ description: L("Description:VisableErrorToClient"),
+ isVisibleToClients: false
+ )
+ .WithProviders(
+ DefaultValueSettingValueProvider.ProviderName,
+ ConfigurationSettingValueProvider.ProviderName,
+ GlobalSettingValueProvider.ProviderName,
+ TenantSettingValueProvider.ProviderName)
+ };
+ }
private ILocalizableString L(string name)
{
return LocalizableString.Create(name);
diff --git a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Sms.Tencent/LINGYUN.Abp.Sms.Tencent.csproj b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Sms.Tencent/LINGYUN.Abp.Sms.Tencent.csproj
index 75746b80c..9bcb96174 100644
--- a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Sms.Tencent/LINGYUN.Abp.Sms.Tencent.csproj
+++ b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Sms.Tencent/LINGYUN.Abp.Sms.Tencent.csproj
@@ -4,14 +4,6 @@
netstandard2.0
-
-
-
-
-
-
-
-
diff --git a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Sms.Tencent/LINGYUN/Abp/Sms/Tencent/Localization/Resources/en.json b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Sms.Tencent/LINGYUN/Abp/Sms/Tencent/Localization/Resources/en.json
deleted file mode 100644
index 5cbf681ec..000000000
--- a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Sms.Tencent/LINGYUN/Abp/Sms/Tencent/Localization/Resources/en.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "culture": "en",
- "texts": {
- "DisplayName:TenantCloud.SmsSetting": "Sms Setting",
- "DisplayName:AppId": "App Id",
- "Description:AppId": "AppId applied on Tencent Cloud SMS control platform.",
- "DisplayName:DefaultSignName": "Default Sign Name",
- "Description:DefaultSignName": "Default signname if no signname is specified in the SMS message body",
- "DisplayName:DefaultTemplateId": "Default Template Id",
- "Description:DefaultTemplateId": "Default template id if the Template Id number is not specified in the SMS message body."
- }
-}
\ No newline at end of file
diff --git a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Sms.Tencent/LINGYUN/Abp/Sms/Tencent/Localization/Resources/zh-Hans.json b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Sms.Tencent/LINGYUN/Abp/Sms/Tencent/Localization/Resources/zh-Hans.json
deleted file mode 100644
index 2f6f529bf..000000000
--- a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Sms.Tencent/LINGYUN/Abp/Sms/Tencent/Localization/Resources/zh-Hans.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "culture": "zh-Hans",
- "texts": {
- "DisplayName:TenantCloud.SmsSetting": "短信设置",
- "DisplayName:AppId": "应用Id",
- "Description:AppId": "在腾讯云短信控制平台申请的应用标识",
- "DisplayName:DefaultSignName": "默认签名",
- "Description:DefaultSignName": "当短信消息体未指定签名时的默认签名",
- "DisplayName:DefaultTemplateId": "默认模板",
- "Description:DefaultTemplateId": "当短信消息体未指定模板号时的默认模板标识"
- }
-}
\ No newline at end of file
diff --git a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Sms.Tencent/LINGYUN/Abp/Sms/Tencent/Settings/TencentCloudSmsSettingNames.cs b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Sms.Tencent/LINGYUN/Abp/Sms/Tencent/Settings/TencentCloudSmsSettingNames.cs
deleted file mode 100644
index 185f31eb0..000000000
--- a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Sms.Tencent/LINGYUN/Abp/Sms/Tencent/Settings/TencentCloudSmsSettingNames.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using LINGYUN.Abp.Tencent.Settings;
-
-namespace LINGYUN.Abp.Sms.Tencent.Settings
-{
- public static class TencentCloudSmsSettingNames
- {
- public const string Prefix = TencentCloudSettingNames.Prefix + ".Sms";
-
- ///
- /// 短信 SdkAppId
- /// 在 短信控制台 添加应用后生成的实际 SdkAppId,示例如1400006666。
- ///
- public const string AppId = Prefix + ".Domain";
- ///
- /// 短信签名内容
- ///
- public const string DefaultSignName = Prefix + ".DefaultSignName";
- ///
- /// 默认短信模板 ID
- ///
- public const string DefaultTemplateId = Prefix + ".DefaultTemplateId";
- }
-}
diff --git a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Sms.Tencent/LINGYUN/Abp/Sms/Tencent/TencentCloudSmsSender.cs b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Sms.Tencent/LINGYUN/Abp/Sms/Tencent/TencentCloudSmsSender.cs
index 2b0f3a7a0..ccdb7705a 100644
--- a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Sms.Tencent/LINGYUN/Abp/Sms/Tencent/TencentCloudSmsSender.cs
+++ b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Sms.Tencent/LINGYUN/Abp/Sms/Tencent/TencentCloudSmsSender.cs
@@ -1,5 +1,5 @@
-using LINGYUN.Abp.Sms.Tencent.Settings;
-using LINGYUN.Abp.Tencent;
+using LINGYUN.Abp.Tencent;
+using LINGYUN.Abp.Tencent.Settings;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using System;
@@ -41,19 +41,19 @@ namespace LINGYUN.Abp.Sms.Tencent
public virtual async Task SendAsync(SmsMessage smsMessage)
{
- var appId = await SettingProvider.GetOrNullAsync(TencentCloudSmsSettingNames.AppId);
+ var appId = await SettingProvider.GetOrNullAsync(TencentCloudSettingNames.Sms.AppId);
- Check.NotNullOrWhiteSpace(appId, TencentCloudSmsSettingNames.AppId);
+ Check.NotNullOrWhiteSpace(appId, TencentCloudSettingNames.Sms.AppId);
// 统一使用 TemplateCode作为模板参数, 解决不一样的sms提供商参数差异
if (!smsMessage.Properties.TryGetValue("TemplateCode", out var templateId))
{
- templateId = await SettingProvider.GetOrNullAsync(TencentCloudSmsSettingNames.DefaultTemplateId);
+ templateId = await SettingProvider.GetOrNullAsync(TencentCloudSettingNames.Sms.DefaultTemplateId);
}
if (!smsMessage.Properties.TryGetValue("SignName", out var signName))
{
- signName = await SettingProvider.GetOrNullAsync(TencentCloudSmsSettingNames.DefaultSignName);
+ signName = await SettingProvider.GetOrNullAsync(TencentCloudSettingNames.Sms.DefaultSignName);
}
var request = new SendSmsRequest
diff --git a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.QQ/FodyWeavers.xml b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.QQ/FodyWeavers.xml
new file mode 100644
index 000000000..1715698cc
--- /dev/null
+++ b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.QQ/FodyWeavers.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.QQ/FodyWeavers.xsd b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.QQ/FodyWeavers.xsd
new file mode 100644
index 000000000..11da52550
--- /dev/null
+++ b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.QQ/FodyWeavers.xsd
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.
+
+
+
+
+ A comma-separated list of error codes that can be safely ignored in assembly verification.
+
+
+
+
+ 'false' to turn off automatic generation of the XML Schema file.
+
+
+
+
+
\ No newline at end of file
diff --git a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN.Abp.Tencent.QQ.csproj b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN.Abp.Tencent.QQ.csproj
new file mode 100644
index 000000000..6637141fd
--- /dev/null
+++ b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN.Abp.Tencent.QQ.csproj
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+ netstandard2.0
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/AbpTencentQQCacheItem.cs b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/AbpTencentQQCacheItem.cs
new file mode 100644
index 000000000..09e993fdb
--- /dev/null
+++ b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/AbpTencentQQCacheItem.cs
@@ -0,0 +1,30 @@
+using System;
+
+namespace LINGYUN.Abp.Tencent.QQ;
+
+public class AbpTencentQQCacheItem
+{
+ public const string CacheKeyFormat = "pn:{0},pk:{1}";
+ public string AppId { get; set; }
+ public string AppKey { get; set; }
+ public bool IsMobile { get; set; }
+ public AbpTencentQQCacheItem()
+ {
+
+ }
+
+ public AbpTencentQQCacheItem(
+ string appId,
+ string appKey,
+ bool isMobile = false)
+ {
+ AppId = appId;
+ AppKey = appKey;
+ IsMobile = isMobile;
+ }
+
+ public static string CalculateCacheKey(Guid? tenantId = null)
+ {
+ return string.Format(CacheKeyFormat, tenantId.HasValue ? tenantId.Value.ToString() : "global", "tenant-qq");
+ }
+}
diff --git a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/AbpTencentQQModule.cs b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/AbpTencentQQModule.cs
new file mode 100644
index 000000000..0a54f6fae
--- /dev/null
+++ b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/AbpTencentQQModule.cs
@@ -0,0 +1,28 @@
+using LINGYUN.Abp.Tencent.Localization;
+using Microsoft.Extensions.DependencyInjection;
+using Volo.Abp.Localization;
+using Volo.Abp.Modularity;
+using Volo.Abp.VirtualFileSystem;
+
+namespace LINGYUN.Abp.Tencent.QQ;
+
+[DependsOn(typeof(AbpTencentCloudModule))]
+public class AbpTencentQQModule : AbpModule
+{
+ public override void ConfigureServices(ServiceConfigurationContext context)
+ {
+ Configure(options =>
+ {
+ options.FileSets.AddEmbedded();
+ });
+
+ Configure(options =>
+ {
+ options.Resources
+ .Get()
+ .AddVirtualJson("/LINGYUN/Abp/Tencent/QQ/Localization");
+ });
+
+ context.Services.AddAbpDynamicOptions();
+ }
+}
diff --git a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/AbpTencentQQOptions.cs b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/AbpTencentQQOptions.cs
new file mode 100644
index 000000000..93aa97f4e
--- /dev/null
+++ b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/AbpTencentQQOptions.cs
@@ -0,0 +1,23 @@
+namespace LINGYUN.Abp.Tencent.QQ;
+
+public class AbpTencentQQOptions
+{
+ ///
+ /// 在QQ互联上申请的AppId
+ ///
+ ///
+ /// see: https://wiki.connect.qq.com/%e5%87%86%e5%a4%87%e5%b7%a5%e4%bd%9c_oauth2-0
+ ///
+ public string AppId { get; set; }
+ ///
+ /// 在QQ互联上申请的AppKey
+ ///
+ ///
+ /// see: https://wiki.connect.qq.com/%e5%87%86%e5%a4%87%e5%b7%a5%e4%bd%9c_oauth2-0
+ ///
+ public string AppKey { get; set; }
+ ///
+ /// 是否移动端样式
+ ///
+ public bool IsMobile { get; set; }
+}
diff --git a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/AbpTencentQQOptionsFactory.cs b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/AbpTencentQQOptionsFactory.cs
new file mode 100644
index 000000000..28094c235
--- /dev/null
+++ b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/AbpTencentQQOptionsFactory.cs
@@ -0,0 +1,24 @@
+using Microsoft.Extensions.Options;
+using System.Threading.Tasks;
+using Volo.Abp.DependencyInjection;
+
+namespace LINGYUN.Abp.Tencent.QQ
+{
+ public class AbpTencentQQOptionsFactory : ITransientDependency
+ {
+ protected IOptions Options { get; }
+
+ public AbpTencentQQOptionsFactory(
+ IOptions options)
+ {
+ Options = options;
+ }
+
+ public virtual async Task CreateAsync()
+ {
+ await Options.SetAsync();
+
+ return Options.Value;
+ }
+ }
+}
diff --git a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/AbpTencentQQOptionsManager.cs b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/AbpTencentQQOptionsManager.cs
new file mode 100644
index 000000000..fe2138187
--- /dev/null
+++ b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/AbpTencentQQOptionsManager.cs
@@ -0,0 +1,57 @@
+using LINGYUN.Abp.Tencent.QQ.Settings;
+using Microsoft.Extensions.Caching.Memory;
+using Microsoft.Extensions.Options;
+using System;
+using System.Threading.Tasks;
+using Volo.Abp.MultiTenancy;
+using Volo.Abp.Options;
+using Volo.Abp.Settings;
+
+namespace LINGYUN.Abp.Tencent.QQ;
+
+public class AbpTencentQQOptionsManager : AbpDynamicOptionsManager
+{
+ protected IMemoryCache TencentCache { get; }
+ protected ICurrentTenant CurrentTenant { get; }
+ protected ISettingProvider SettingProvider { get; }
+ public AbpTencentQQOptionsManager(
+ IMemoryCache tencentCache,
+ ICurrentTenant currentTenant,
+ ISettingProvider settingProvider,
+ IOptionsFactory factory)
+ : base(factory)
+ {
+ TencentCache = tencentCache;
+ CurrentTenant = currentTenant;
+ SettingProvider = settingProvider;
+ }
+
+ protected override async Task OverrideOptionsAsync(string name, AbpTencentQQOptions options)
+ {
+ var cacheItem = await GetCacheItemAsync();
+
+ options.AppId = cacheItem.AppId;
+ options.AppKey = cacheItem.AppKey;
+ options.IsMobile = cacheItem.IsMobile;
+ }
+
+ protected virtual async Task GetCacheItemAsync()
+ {
+ var cacheKey = AbpTencentQQCacheItem.CalculateCacheKey(CurrentTenant.Id);
+
+ var cacheItem = await TencentCache.GetOrCreateAsync(
+ cacheKey,
+ async (cache) =>
+ {
+ var appId = await SettingProvider.GetOrNullAsync(TencentQQSettingNames.QQConnect.AppId);
+ var appKey = await SettingProvider.GetOrNullAsync(TencentQQSettingNames.QQConnect.AppKey);
+ var isMobile = await SettingProvider.IsTrueAsync(TencentQQSettingNames.QQConnect.IsMobile);
+
+ cache.SetAbsoluteExpiration(TimeSpan.FromMinutes(2d));
+
+ return new AbpTencentQQCacheItem(appId, appKey, isMobile);
+ });
+
+ return cacheItem;
+ }
+}
diff --git a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/Localization/en.json b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/Localization/en.json
new file mode 100644
index 000000000..b037ebc49
--- /dev/null
+++ b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/Localization/en.json
@@ -0,0 +1,13 @@
+{
+ "culture": "en",
+ "texts": {
+ "DisplayName:TenantCloud.QQConnect": "QQ Connect",
+ "Description:TenantCloud.QQConnect": "Access QQ Internet open platform",
+ "DisplayName:QQConnect.AppId": "AppId",
+ "Description:QQConnect.AppId": "The application identification necessary to access QQ login can be applied at QQ Interconnection Management Center.",
+ "DisplayName:QQConnect.AppKey": "AppKey",
+ "Description:QQConnect.AppKey": "When accessing user resources, it is used to verify the validity of the application and apply for it in QQ Interconnection Management Center.",
+ "DisplayName:QQConnect.IsMobile": "Whether to move the style",
+ "Description:QQConnect.IsMobile": "The style used for display is displayed as the style under PC by default."
+ }
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/Localization/zh-Hans.json b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/Localization/zh-Hans.json
new file mode 100644
index 000000000..e8c769595
--- /dev/null
+++ b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/Localization/zh-Hans.json
@@ -0,0 +1,13 @@
+{
+ "culture": "zh-Hans",
+ "texts": {
+ "DisplayName:TenantCloud.QQConnect": "QQ互联",
+ "Description:TenantCloud.QQConnect": "接入QQ互联开放平台",
+ "DisplayName:QQConnect.AppId": "应用的唯一标识",
+ "Description:QQConnect.AppId": "接入QQ登录所必须的应用标识, 在QQ互联管理中心申请.",
+ "DisplayName:QQConnect.AppKey": "AppId对应的密钥",
+ "Description:QQConnect.AppKey": "访问用户资源时用来验证应用的合法性, 在QQ互联管理中心申请.",
+ "DisplayName:QQConnect.IsMobile": "是否移动端样式",
+ "Description:QQConnect.IsMobile": "用于展示的样式, 默认展示为PC下的样式."
+ }
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Sms.Tencent/LINGYUN/Abp/Sms/Tencent/Settings/TencentCloudSmsSettingProvider.cs b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/Settings/TencentQQSettingDefinitionProvider.cs
similarity index 57%
rename from aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Sms.Tencent/LINGYUN/Abp/Sms/Tencent/Settings/TencentCloudSmsSettingProvider.cs
rename to aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/Settings/TencentQQSettingDefinitionProvider.cs
index 7421de34c..5990dc671 100644
--- a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Sms.Tencent/LINGYUN/Abp/Sms/Tencent/Settings/TencentCloudSmsSettingProvider.cs
+++ b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/Settings/TencentQQSettingDefinitionProvider.cs
@@ -1,60 +1,58 @@
-using LINGYUN.Abp.Tencent.Localization;
+using LINGYUN.Abp.Tencent.Localization;
using Volo.Abp.Localization;
using Volo.Abp.Settings;
-namespace LINGYUN.Abp.Sms.Tencent.Settings
+namespace LINGYUN.Abp.Tencent.QQ.Settings
{
- public class TencentCloudSmsSettingProvider : SettingDefinitionProvider
+ public class TencentQQSettingDefinitionProvider : SettingDefinitionProvider
{
public override void Define(ISettingDefinitionContext context)
{
- context.Add(CreateAliyunSettings());
+ context.Add(GetQQConnectSettings());
}
- private SettingDefinition[] CreateAliyunSettings()
- {
- return new SettingDefinition[]
- {
+ private SettingDefinition[] GetQQConnectSettings()
+ {
+ return new SettingDefinition[]
+ {
new SettingDefinition(
- TencentCloudSmsSettingNames.AppId,
- displayName: L("DisplayName:AppId"),
- description: L("Description:AppId"),
+ TencentQQSettingNames.QQConnect.AppId, "",
+ L("DisplayName:QQConnect.AppId"),
+ L("Description:QQConnect.AppId"),
isVisibleToClients: false,
- isEncrypted: true
- )
+ isEncrypted: true)
.WithProviders(
DefaultValueSettingValueProvider.ProviderName,
ConfigurationSettingValueProvider.ProviderName,
GlobalSettingValueProvider.ProviderName,
TenantSettingValueProvider.ProviderName),
new SettingDefinition(
- TencentCloudSmsSettingNames.DefaultSignName,
- displayName: L("DisplayName:DefaultSignName"),
- description: L("Description:DefaultSignName"),
+ TencentQQSettingNames.QQConnect.AppKey, "",
+ L("DisplayName:QQConnect.AppKey"),
+ L("Description:QQConnect.AppKey"),
isVisibleToClients: false,
- isEncrypted: true
- )
+ isEncrypted: true)
.WithProviders(
DefaultValueSettingValueProvider.ProviderName,
ConfigurationSettingValueProvider.ProviderName,
GlobalSettingValueProvider.ProviderName,
TenantSettingValueProvider.ProviderName),
new SettingDefinition(
- TencentCloudSmsSettingNames.DefaultTemplateId,
- displayName: L("DisplayName:DefaultTemplateId"),
- description: L("Description:DefaultTemplateId"),
+ TencentQQSettingNames.QQConnect.IsMobile,
+ "false",
+ L("DisplayName:QQConnect.IsMobile"),
+ L("Description:QQConnect.IsMobile"),
isVisibleToClients: false,
- isEncrypted: true
- )
+ isEncrypted: false)
.WithProviders(
DefaultValueSettingValueProvider.ProviderName,
ConfigurationSettingValueProvider.ProviderName,
GlobalSettingValueProvider.ProviderName,
- TenantSettingValueProvider.ProviderName),
- };
+ TenantSettingValueProvider.ProviderName)
+ };
}
- private ILocalizableString L(string name)
+ protected ILocalizableString L(string name)
{
return LocalizableString.Create(name);
}
diff --git a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/Settings/TencentQQSettingNames.cs b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/Settings/TencentQQSettingNames.cs
new file mode 100644
index 000000000..5ba589976
--- /dev/null
+++ b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/Settings/TencentQQSettingNames.cs
@@ -0,0 +1,16 @@
+using LINGYUN.Abp.Tencent.Settings;
+
+namespace LINGYUN.Abp.Tencent.QQ.Settings
+{
+ public class TencentQQSettingNames
+ {
+ public static class QQConnect
+ {
+ private const string Prefix = TencentCloudSettingNames.Prefix + ".QQConnect";
+
+ public const string AppId = Prefix + ".AppId";
+ public const string AppKey = Prefix + ".AppKey";
+ public const string IsMobile = Prefix + ".IsMobile";
+ }
+ }
+}
diff --git a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.SettingManagement/LINGYUN.Abp.Tencent.SettingManagement.csproj b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.SettingManagement/LINGYUN.Abp.Tencent.SettingManagement.csproj
index 1b20b4cf4..bec2dcf28 100644
--- a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.SettingManagement/LINGYUN.Abp.Tencent.SettingManagement.csproj
+++ b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.SettingManagement/LINGYUN.Abp.Tencent.SettingManagement.csproj
@@ -19,7 +19,7 @@
-
+
diff --git a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.SettingManagement/LINGYUN/Abp/Tencent/SettingManagement/AbpTencentCloudSettingManagementModule.cs b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.SettingManagement/LINGYUN/Abp/Tencent/SettingManagement/AbpTencentCloudSettingManagementModule.cs
index a15337dca..cf2c5d708 100644
--- a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.SettingManagement/LINGYUN/Abp/Tencent/SettingManagement/AbpTencentCloudSettingManagementModule.cs
+++ b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.SettingManagement/LINGYUN/Abp/Tencent/SettingManagement/AbpTencentCloudSettingManagementModule.cs
@@ -1,4 +1,5 @@
using LINGYUN.Abp.SettingManagement;
+using LINGYUN.Abp.Tencent.QQ;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Modularity;
using Volo.Abp.SettingManagement;
@@ -7,6 +8,7 @@ namespace LINGYUN.Abp.Tencent.SettingManagement;
[DependsOn(
typeof(AbpTencentCloudModule),
+ typeof(AbpTencentQQModule),
typeof(AbpSettingManagementApplicationContractsModule),
typeof(AbpSettingManagementDomainModule),
typeof(AbpAspNetCoreMvcModule))]
diff --git a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.SettingManagement/LINGYUN/Abp/Tencent/SettingManagement/TenantCloudSettingAppService.cs b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.SettingManagement/LINGYUN/Abp/Tencent/SettingManagement/TenantCloudSettingAppService.cs
index 5238d64bf..1fec8cb73 100644
--- a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.SettingManagement/LINGYUN/Abp/Tencent/SettingManagement/TenantCloudSettingAppService.cs
+++ b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent.SettingManagement/LINGYUN/Abp/Tencent/SettingManagement/TenantCloudSettingAppService.cs
@@ -1,6 +1,6 @@
using LINGYUN.Abp.SettingManagement;
-using LINGYUN.Abp.Sms.Tencent.Settings;
using LINGYUN.Abp.Tencent.Localization;
+using LINGYUN.Abp.Tencent.QQ.Settings;
using LINGYUN.Abp.Tencent.Settings;
using System.Collections.Generic;
using System.Threading.Tasks;
@@ -116,26 +116,52 @@ public class TenantCloudSettingAppService : ApplicationService, ITenantCloudSett
L["DisplayName:TenantCloud.SmsSetting"], L["Description:TenantCloud.SmsSetting"]);
smsSetting.AddDetail(
- SettingDefinitionManager.Get(TencentCloudSmsSettingNames.AppId),
+ SettingDefinitionManager.Get(TencentCloudSettingNames.Sms.AppId),
StringLocalizerFactory,
- await SettingManager.GetOrNullAsync(TencentCloudSmsSettingNames.AppId, providerName, providerKey),
+ await SettingManager.GetOrNullAsync(TencentCloudSettingNames.Sms.AppId, providerName, providerKey),
ValueType.String,
providerName);
smsSetting.AddDetail(
- SettingDefinitionManager.Get(TencentCloudSmsSettingNames.DefaultTemplateId),
+ SettingDefinitionManager.Get(TencentCloudSettingNames.Sms.DefaultTemplateId),
StringLocalizerFactory,
- await SettingManager.GetOrNullAsync(TencentCloudSmsSettingNames.DefaultTemplateId, providerName, providerKey),
+ await SettingManager.GetOrNullAsync(TencentCloudSettingNames.Sms.DefaultTemplateId, providerName, providerKey),
ValueType.String,
providerName);
smsSetting.AddDetail(
- SettingDefinitionManager.Get(TencentCloudSmsSettingNames.DefaultSignName),
+ SettingDefinitionManager.Get(TencentCloudSettingNames.Sms.DefaultSignName),
StringLocalizerFactory,
- await SettingManager.GetOrNullAsync(TencentCloudSmsSettingNames.DefaultSignName, providerName, providerKey),
+ await SettingManager.GetOrNullAsync(TencentCloudSettingNames.Sms.DefaultSignName, providerName, providerKey),
ValueType.String,
providerName);
#endregion
+ #region QQ互联
+
+ var qqSetting = settingGroup.AddSetting(
+ L["DisplayName:TenantCloud.QQConnect"], L["Description:TenantCloud.QQConnect"]);
+
+ qqSetting.AddDetail(
+ SettingDefinitionManager.Get(TencentQQSettingNames.QQConnect.AppId),
+ StringLocalizerFactory,
+ await SettingManager.GetOrNullAsync(TencentQQSettingNames.QQConnect.AppId, providerName, providerKey),
+ ValueType.String,
+ providerName);
+ qqSetting.AddDetail(
+ SettingDefinitionManager.Get(TencentQQSettingNames.QQConnect.AppKey),
+ StringLocalizerFactory,
+ await SettingManager.GetOrNullAsync(TencentQQSettingNames.QQConnect.AppKey, providerName, providerKey),
+ ValueType.String,
+ providerName);
+ qqSetting.AddDetail(
+ SettingDefinitionManager.Get(TencentQQSettingNames.QQConnect.IsMobile),
+ StringLocalizerFactory,
+ await SettingManager.GetOrNullAsync(TencentQQSettingNames.QQConnect.IsMobile, providerName, providerKey),
+ ValueType.Boolean,
+ providerName);
+
+ #endregion
+
settingGroups.AddGroup(settingGroup);
}
diff --git a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent/LINYUN/Abp/Tencent/Localization/Resources/en.json b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent/LINYUN/Abp/Tencent/Localization/Resources/en.json
index f54f6bf1b..97e605f71 100644
--- a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent/LINYUN/Abp/Tencent/Localization/Resources/en.json
+++ b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent/LINYUN/Abp/Tencent/Localization/Resources/en.json
@@ -20,6 +20,13 @@
"Description:Timeout": "Connection timeout, in seconds (default: 60 seconds)",
"DisplayName:WebProxy": "Web Proxy",
"Description:WebProxy": "Proxy server, set when there are proxy servers in your environment.",
+ "DisplayName:TenantCloud.SmsSetting": "Sms Setting",
+ "DisplayName:AppId": "App Id",
+ "Description:AppId": "AppId applied on Tencent Cloud SMS control platform.",
+ "DisplayName:DefaultSignName": "Default Sign Name",
+ "Description:DefaultSignName": "Default signname if no signname is specified in the SMS message body",
+ "DisplayName:DefaultTemplateId": "Default Template Id",
+ "Description:DefaultTemplateId": "Default template id if the Template Id number is not specified in the SMS message body.",
"Region:Beijing": "North China (Beijing)",
"Region:Chengdu": "Southwest China (Chengdu)",
"Region:Chongqing": "Southwest China (Chongqing)",
diff --git a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent/LINYUN/Abp/Tencent/Localization/Resources/zh-Hans.json b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent/LINYUN/Abp/Tencent/Localization/Resources/zh-Hans.json
index 9a264d129..cba5437d4 100644
--- a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent/LINYUN/Abp/Tencent/Localization/Resources/zh-Hans.json
+++ b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent/LINYUN/Abp/Tencent/Localization/Resources/zh-Hans.json
@@ -20,6 +20,13 @@
"Description:Timeout": "请求连接超时时间,单位为秒(默认60秒)",
"DisplayName:WebProxy": "代理服务器",
"Description:WebProxy": "代理服务器,当你的环境下有代理服务器时设定",
+ "DisplayName:TenantCloud.SmsSetting": "短信设置",
+ "DisplayName:AppId": "应用Id",
+ "Description:AppId": "在腾讯云短信控制平台申请的应用标识",
+ "DisplayName:DefaultSignName": "默认签名",
+ "Description:DefaultSignName": "当短信消息体未指定签名时的默认签名",
+ "DisplayName:DefaultTemplateId": "默认模板",
+ "Description:DefaultTemplateId": "当短信消息体未指定模板号时的默认模板标识",
"Region:Beijing": "华北地区(北京)",
"Region:Chengdu": "西南地区(成都)",
"Region:Chongqing": "西南地区(重庆)",
diff --git a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent/LINYUN/Abp/Tencent/Settings/TencentCloudSettingDefinitionProvider.cs b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent/LINYUN/Abp/Tencent/Settings/TencentCloudSettingDefinitionProvider.cs
index 670e41d9b..539018d8c 100644
--- a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent/LINYUN/Abp/Tencent/Settings/TencentCloudSettingDefinitionProvider.cs
+++ b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent/LINYUN/Abp/Tencent/Settings/TencentCloudSettingDefinitionProvider.cs
@@ -9,19 +9,34 @@ public class TencentCloudSettingDefinitionProvider : SettingDefinitionProvider
{
public override void Define(ISettingDefinitionContext context)
{
- context.Add(CreateTencentCloudSettings());
+ context.Add(GetBasicSettings());
+ context.Add(GetConnectionSettings());
+ context.Add(GetSmsSettings());
}
- private SettingDefinition[] CreateTencentCloudSettings()
+ private SettingDefinition[] GetConnectionSettings()
{
return new SettingDefinition[]
{
+ new SettingDefinition(
+ TencentCloudSettingNames.Connection.HttpMethod,
+ // 默认 post
+ defaultValue: "POST",
+ displayName: L("DisplayName:HttpMethod"),
+ description: L("Description:HttpMethod"),
+ isVisibleToClients: false
+ )
+ .WithProviders(
+ DefaultValueSettingValueProvider.ProviderName,
+ ConfigurationSettingValueProvider.ProviderName,
+ GlobalSettingValueProvider.ProviderName,
+ TenantSettingValueProvider.ProviderName),
new SettingDefinition(
- TencentCloudSettingNames.EndPoint,
- // 腾讯云默认使用广州区域
- defaultValue: "ap-guangzhou",
- displayName: L("DisplayName:EndPoint"),
- description: L("Description:EndPoint"),
+ TencentCloudSettingNames.Connection.Timeout,
+ // 默认 60秒
+ defaultValue: "60",
+ displayName: L("DisplayName:Timeout"),
+ description: L("Description:Timeout"),
isVisibleToClients: false
)
.WithProviders(
@@ -30,9 +45,27 @@ public class TencentCloudSettingDefinitionProvider : SettingDefinitionProvider
GlobalSettingValueProvider.ProviderName,
TenantSettingValueProvider.ProviderName),
new SettingDefinition(
- TencentCloudSettingNames.SecretId,
- displayName: L("DisplayName:SecretId"),
- description: L("Description:SecretId"),
+ TencentCloudSettingNames.Connection.WebProxy,
+ displayName: L("DisplayName:WebProxy"),
+ description: L("Description:WebProxy"),
+ isVisibleToClients: false
+ )
+ .WithProviders(
+ DefaultValueSettingValueProvider.ProviderName,
+ ConfigurationSettingValueProvider.ProviderName,
+ GlobalSettingValueProvider.ProviderName,
+ TenantSettingValueProvider.ProviderName),
+ };
+ }
+
+ private SettingDefinition[] GetSmsSettings()
+ {
+ return new SettingDefinition[]
+ {
+ new SettingDefinition(
+ TencentCloudSettingNames.Sms.AppId,
+ displayName: L("DisplayName:AppId"),
+ description: L("Description:AppId"),
isVisibleToClients: false,
isEncrypted: true
)
@@ -42,9 +75,9 @@ public class TencentCloudSettingDefinitionProvider : SettingDefinitionProvider
GlobalSettingValueProvider.ProviderName,
TenantSettingValueProvider.ProviderName),
new SettingDefinition(
- TencentCloudSettingNames.SecretKey,
- displayName: L("DisplayName:SecretKey"),
- description: L("Description:SecretKey"),
+ TencentCloudSettingNames.Sms.DefaultSignName,
+ displayName: L("DisplayName:DefaultSignName"),
+ description: L("Description:DefaultSignName"),
isVisibleToClients: false,
isEncrypted: true
)
@@ -54,23 +87,30 @@ public class TencentCloudSettingDefinitionProvider : SettingDefinitionProvider
GlobalSettingValueProvider.ProviderName,
TenantSettingValueProvider.ProviderName),
new SettingDefinition(
- TencentCloudSettingNames.DurationSecond,
- defaultValue: "600",
- displayName: L("DisplayName:DurationSecond"),
- description: L("Description:DurationSecond"),
- isVisibleToClients: false
+ TencentCloudSettingNames.Sms.DefaultTemplateId,
+ displayName: L("DisplayName:DefaultTemplateId"),
+ description: L("Description:DefaultTemplateId"),
+ isVisibleToClients: false,
+ isEncrypted: true
)
.WithProviders(
DefaultValueSettingValueProvider.ProviderName,
ConfigurationSettingValueProvider.ProviderName,
GlobalSettingValueProvider.ProviderName,
TenantSettingValueProvider.ProviderName),
+ };
+ }
+
+ private SettingDefinition[] GetBasicSettings()
+ {
+ return new SettingDefinition[]
+ {
new SettingDefinition(
- TencentCloudSettingNames.Connection.HttpMethod,
- // 默认 post
- defaultValue: "POST",
- displayName: L("DisplayName:HttpMethod"),
- description: L("Description:HttpMethod"),
+ TencentCloudSettingNames.EndPoint,
+ // 腾讯云默认使用广州区域
+ defaultValue: "ap-guangzhou",
+ displayName: L("DisplayName:EndPoint"),
+ description: L("Description:EndPoint"),
isVisibleToClients: false
)
.WithProviders(
@@ -79,12 +119,11 @@ public class TencentCloudSettingDefinitionProvider : SettingDefinitionProvider
GlobalSettingValueProvider.ProviderName,
TenantSettingValueProvider.ProviderName),
new SettingDefinition(
- TencentCloudSettingNames.Connection.Timeout,
- // 默认 60秒
- defaultValue: "60",
- displayName: L("DisplayName:Timeout"),
- description: L("Description:Timeout"),
- isVisibleToClients: false
+ TencentCloudSettingNames.SecretId,
+ displayName: L("DisplayName:SecretId"),
+ description: L("Description:SecretId"),
+ isVisibleToClients: false,
+ isEncrypted: true
)
.WithProviders(
DefaultValueSettingValueProvider.ProviderName,
@@ -92,9 +131,22 @@ public class TencentCloudSettingDefinitionProvider : SettingDefinitionProvider
GlobalSettingValueProvider.ProviderName,
TenantSettingValueProvider.ProviderName),
new SettingDefinition(
- TencentCloudSettingNames.Connection.WebProxy,
- displayName: L("DisplayName:WebProxy"),
- description: L("Description:WebProxy"),
+ TencentCloudSettingNames.SecretKey,
+ displayName: L("DisplayName:SecretKey"),
+ description: L("Description:SecretKey"),
+ isVisibleToClients: false,
+ isEncrypted: true
+ )
+ .WithProviders(
+ DefaultValueSettingValueProvider.ProviderName,
+ ConfigurationSettingValueProvider.ProviderName,
+ GlobalSettingValueProvider.ProviderName,
+ TenantSettingValueProvider.ProviderName),
+ new SettingDefinition(
+ TencentCloudSettingNames.DurationSecond,
+ defaultValue: "600",
+ displayName: L("DisplayName:DurationSecond"),
+ description: L("Description:DurationSecond"),
isVisibleToClients: false
)
.WithProviders(
diff --git a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent/LINYUN/Abp/Tencent/Settings/TencentCloudSettingNames.cs b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent/LINYUN/Abp/Tencent/Settings/TencentCloudSettingNames.cs
index 944713db2..16de75c0d 100644
--- a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent/LINYUN/Abp/Tencent/Settings/TencentCloudSettingNames.cs
+++ b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent/LINYUN/Abp/Tencent/Settings/TencentCloudSettingNames.cs
@@ -44,4 +44,22 @@ public static class TencentCloudSettingNames
///
public const string Timeout = Prefix + ".Timeout";
}
+
+ public static class Sms
+ {
+ private const string Prefix = TencentCloudSettingNames.Prefix + ".Sms";
+ ///
+ /// 短信 SdkAppId
+ /// 在 短信控制台 添加应用后生成的实际 SdkAppId,示例如1400006666。
+ ///
+ public const string AppId = Prefix + ".Domain";
+ ///
+ /// 短信签名内容
+ ///
+ public const string DefaultSignName = Prefix + ".DefaultSignName";
+ ///
+ /// 默认短信模板 ID
+ ///
+ public const string DefaultTemplateId = Prefix + ".DefaultTemplateId";
+ }
}
diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Sms.Aliyun/LINGYUN/Abp/Sms/Aliyun/AliyunSmsSender.cs b/aspnet-core/modules/common/LINGYUN.Abp.Sms.Aliyun/LINGYUN/Abp/Sms/Aliyun/AliyunSmsSender.cs
index 85566aa19..5d02fa092 100644
--- a/aspnet-core/modules/common/LINGYUN.Abp.Sms.Aliyun/LINGYUN/Abp/Sms/Aliyun/AliyunSmsSender.cs
+++ b/aspnet-core/modules/common/LINGYUN.Abp.Sms.Aliyun/LINGYUN/Abp/Sms/Aliyun/AliyunSmsSender.cs
@@ -2,10 +2,9 @@
using Aliyun.Acs.Core.Exceptions;
using Aliyun.Acs.Core.Http;
using LINGYUN.Abp.Aliyun;
-using LINGYUN.Abp.Sms.Aliyun.Settings;
+using LINGYUN.Abp.Aliyun.Settings;
using Microsoft.Extensions.DependencyInjection;
using System;
-using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -39,13 +38,13 @@ namespace LINGYUN.Abp.Sms.Aliyun
public virtual async Task SendAsync(SmsMessage smsMessage)
{
- var domain = await SettingProvider.GetOrNullAsync(AliyunSmsSettingNames.Sms.Domain);
- var action = await SettingProvider.GetOrNullAsync(AliyunSmsSettingNames.Sms.ActionName);
- var version = await SettingProvider.GetOrNullAsync(AliyunSmsSettingNames.Sms.Version);
+ var domain = await SettingProvider.GetOrNullAsync(AliyunSettingNames.Sms.Domain);
+ var action = await SettingProvider.GetOrNullAsync(AliyunSettingNames.Sms.ActionName);
+ var version = await SettingProvider.GetOrNullAsync(AliyunSettingNames.Sms.Version);
- Check.NotNullOrWhiteSpace(domain, AliyunSmsSettingNames.Sms.Domain);
- Check.NotNullOrWhiteSpace(action, AliyunSmsSettingNames.Sms.ActionName);
- Check.NotNullOrWhiteSpace(version, AliyunSmsSettingNames.Sms.Version);
+ Check.NotNullOrWhiteSpace(domain, AliyunSettingNames.Sms.Domain);
+ Check.NotNullOrWhiteSpace(action, AliyunSettingNames.Sms.ActionName);
+ Check.NotNullOrWhiteSpace(version, AliyunSettingNames.Sms.Version);
CommonRequest request = new CommonRequest
{
@@ -68,7 +67,7 @@ namespace LINGYUN.Abp.Sms.Aliyun
var aliyunResponse = JsonSerializer.Deserialize(responseContent);
if (!aliyunResponse.IsSuccess())
{
- if (await SettingProvider.IsTrueAsync(AliyunSmsSettingNames.Sms.VisableErrorToClient))
+ if (await SettingProvider.IsTrueAsync(AliyunSettingNames.Sms.VisableErrorToClient))
{
throw new UserFriendlyException(aliyunResponse.Code, aliyunResponse.Message);
}
@@ -94,7 +93,7 @@ namespace LINGYUN.Abp.Sms.Aliyun
}
else
{
- var defaultTemplateCode = await SettingProvider.GetOrNullAsync(AliyunSmsSettingNames.Sms.DefaultTemplateCode);
+ var defaultTemplateCode = await SettingProvider.GetOrNullAsync(AliyunSettingNames.Sms.DefaultTemplateCode);
Check.NotNullOrWhiteSpace(defaultTemplateCode, "TemplateCode");
request.AddQueryParameters("TemplateCode", defaultTemplateCode);
}
@@ -109,7 +108,7 @@ namespace LINGYUN.Abp.Sms.Aliyun
}
else
{
- var defaultSignName = await SettingProvider.GetOrNullAsync(AliyunSmsSettingNames.Sms.DefaultSignName);
+ var defaultSignName = await SettingProvider.GetOrNullAsync(AliyunSettingNames.Sms.DefaultSignName);
Check.NotNullOrWhiteSpace(defaultSignName, "SignName");
request.AddQueryParameters("SignName", defaultSignName);
}
@@ -119,11 +118,11 @@ namespace LINGYUN.Abp.Sms.Aliyun
{
if (smsMessage.PhoneNumber.IsNullOrWhiteSpace())
{
- var defaultPhoneNumber = await SettingProvider.GetOrNullAsync(AliyunSmsSettingNames.Sms.DefaultPhoneNumber);
+ var defaultPhoneNumber = await SettingProvider.GetOrNullAsync(AliyunSettingNames.Sms.DefaultPhoneNumber);
// check phone number length...
Check.NotNullOrWhiteSpace(
defaultPhoneNumber,
- AliyunSmsSettingNames.Sms.DefaultPhoneNumber,
+ AliyunSettingNames.Sms.DefaultPhoneNumber,
maxLength: 11, minLength: 11);
request.AddQueryParameters("PhoneNumbers", defaultPhoneNumber);
}
diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Sms.Aliyun/LINGYUN/Abp/Sms/Aliyun/Localization/Resources/en.json b/aspnet-core/modules/common/LINGYUN.Abp.Sms.Aliyun/LINGYUN/Abp/Sms/Aliyun/Localization/Resources/en.json
index 8e9508511..5ef98e5a2 100644
--- a/aspnet-core/modules/common/LINGYUN.Abp.Sms.Aliyun/LINGYUN/Abp/Sms/Aliyun/Localization/Resources/en.json
+++ b/aspnet-core/modules/common/LINGYUN.Abp.Sms.Aliyun/LINGYUN/Abp/Sms/Aliyun/Localization/Resources/en.json
@@ -1,22 +1,6 @@
{
"culture": "en",
"texts": {
- "DisplayName:Aliyun.Sms": "Sms",
- "Description:Aliyun.Sms": "Sms",
- "DisplayName:ActionName": "Action Name",
- "Description:ActionName": "Action Name",
- "DisplayName:DefaultSignName": "Default Sign Name",
- "Description:DefaultSignName": "Default Sign Name",
- "DisplayName:DefaultTemplateCode": "Default Template Code",
- "Description:DefaultTemplateCode": "Default Template Code",
- "DisplayName:DefaultPhoneNumber": "Default Phone Number",
- "Description:DefaultPhoneNumber": "Default Phone Number",
- "DisplayName:Domain": "Domain",
- "Description:Domain": "Domain",
- "DisplayName:Version": "Version",
- "Description:Version": "Version",
- "DisplayName:VisableErrorToClient": "Visable Error To Client",
- "Description:VisableErrorToClient": "Visable Error To Client",
"SendMessageFailed": "Text message sending failed:{0}",
"SMS_SIGNATURE_SCENE_ILLEGAL": "Signature scene used by SMS is illegal",
"DENY_IP_RANGE": "Region where source IP address is disabled",
diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Sms.Aliyun/LINGYUN/Abp/Sms/Aliyun/Localization/Resources/zh-Hans.json b/aspnet-core/modules/common/LINGYUN.Abp.Sms.Aliyun/LINGYUN/Abp/Sms/Aliyun/Localization/Resources/zh-Hans.json
index 64b5e3304..f2ba1b6a5 100644
--- a/aspnet-core/modules/common/LINGYUN.Abp.Sms.Aliyun/LINGYUN/Abp/Sms/Aliyun/Localization/Resources/zh-Hans.json
+++ b/aspnet-core/modules/common/LINGYUN.Abp.Sms.Aliyun/LINGYUN/Abp/Sms/Aliyun/Localization/Resources/zh-Hans.json
@@ -1,22 +1,6 @@
{
"culture": "zh-Hans",
"texts": {
- "DisplayName:Aliyun.Sms": "短信服务",
- "Description:Aliyun.Sms": "阿里云短信服务",
- "DisplayName:ActionName": "发送短信方法",
- "Description:ActionName": "发送短信方法名称,详情见阿里云Sms服务",
- "DisplayName:DefaultSignName": "默认短信签名",
- "Description:DefaultSignName": "当用户未指定短信签名时的默认签名名称",
- "DisplayName:DefaultTemplateCode": "默认短信模板号",
- "Description:DefaultTemplateCode": "当用户未指定短信签名时的默认短信模板号",
- "DisplayName:DefaultPhoneNumber": "默认接收短信手机号",
- "Description:DefaultPhoneNumber": "当用户未指定短信接收方时的默认接收手机号码",
- "DisplayName:Domain": "阿里云sms服务域名",
- "Description:Domain": "阿里云sms服务域名",
- "DisplayName:Version": "阿里云sms服务版本号",
- "Description:Version": "阿里云sms服务版本号",
- "DisplayName:VisableErrorToClient": "发送错误到客户端",
- "Description:VisableErrorToClient": "当短信服务发送出现错误时是否发送错误详情到客户端",
"SendMessageFailed": "发送短信错误:{0}",
"SMS_SIGNATURE_SCENE_ILLEGAL": "短信所使用签名场景非法",
"DENY_IP_RANGE": "源IP地址所在的地区被禁用",
diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Sms.Aliyun/LINGYUN/Abp/Sms/Aliyun/Settings/AliyunSmsSettingNames.cs b/aspnet-core/modules/common/LINGYUN.Abp.Sms.Aliyun/LINGYUN/Abp/Sms/Aliyun/Settings/AliyunSmsSettingNames.cs
deleted file mode 100644
index 5781114fd..000000000
--- a/aspnet-core/modules/common/LINGYUN.Abp.Sms.Aliyun/LINGYUN/Abp/Sms/Aliyun/Settings/AliyunSmsSettingNames.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-using LINGYUN.Abp.Aliyun.Settings;
-
-namespace LINGYUN.Abp.Sms.Aliyun.Settings
-{
- public static class AliyunSmsSettingNames
- {
- ///
- /// 短信服务
- ///
- public class Sms
- {
- public const string Prefix = AliyunSettingNames.Prefix + ".Sms";
- ///
- /// 阿里云sms服务域名
- ///
- public const string Domain = Prefix + ".Domain";
- ///
- /// 调用方法名称
- ///
- public const string ActionName = Prefix + ".ActionName";
- ///
- /// 默认版本号
- ///
- public const string Version = Prefix + ".Version";
- ///
- /// 默认签名
- ///
- public const string DefaultSignName = Prefix + ".DefaultSignName";
- ///
- /// 默认短信模板号
- ///
- public const string DefaultTemplateCode = Prefix + ".DefaultTemplateCode";
- ///
- /// 默认号码
- ///
- public const string DefaultPhoneNumber = Prefix + ".DefaultPhoneNumber";
- ///
- /// 展示错误给客户端
- ///
- public const string VisableErrorToClient = Prefix + ".VisableErrorToClient";
- }
- }
-}
diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Sms.Aliyun/LINGYUN/Abp/Sms/Aliyun/Settings/AliyunSmsSettingProvider.cs b/aspnet-core/modules/common/LINGYUN.Abp.Sms.Aliyun/LINGYUN/Abp/Sms/Aliyun/Settings/AliyunSmsSettingProvider.cs
deleted file mode 100644
index fdb5fa212..000000000
--- a/aspnet-core/modules/common/LINGYUN.Abp.Sms.Aliyun/LINGYUN/Abp/Sms/Aliyun/Settings/AliyunSmsSettingProvider.cs
+++ /dev/null
@@ -1,109 +0,0 @@
-using LINGYUN.Abp.Aliyun.Localization;
-using Volo.Abp.Localization;
-using Volo.Abp.Settings;
-
-namespace LINGYUN.Abp.Sms.Aliyun.Settings
-{
- public class AliyunSmsSettingProvider : SettingDefinitionProvider
- {
- public override void Define(ISettingDefinitionContext context)
- {
- context.Add(CreateAliyunSettings());
- }
-
- private SettingDefinition[] CreateAliyunSettings()
- {
- return new SettingDefinition[]
- {
- new SettingDefinition(
- AliyunSmsSettingNames.Sms.ActionName,
- defaultValue: "SendSms",
- displayName: L("DisplayName:ActionName"),
- description: L("Description:ActionName"),
- isVisibleToClients: false
- )
- .WithProviders(
- DefaultValueSettingValueProvider.ProviderName,
- ConfigurationSettingValueProvider.ProviderName,
- GlobalSettingValueProvider.ProviderName,
- TenantSettingValueProvider.ProviderName),
- new SettingDefinition(
- AliyunSmsSettingNames.Sms.DefaultSignName,
- displayName: L("DisplayName:DefaultSignName"),
- description: L("Description:DefaultSignName"),
- isVisibleToClients: false,
- isEncrypted: true
- )
- .WithProviders(
- DefaultValueSettingValueProvider.ProviderName,
- ConfigurationSettingValueProvider.ProviderName,
- GlobalSettingValueProvider.ProviderName,
- TenantSettingValueProvider.ProviderName),
- new SettingDefinition(
- AliyunSmsSettingNames.Sms.DefaultTemplateCode,
- displayName: L("DisplayName:DefaultTemplateCode"),
- description: L("Description:DefaultTemplateCode"),
- isVisibleToClients: false,
- isEncrypted: true
- )
- .WithProviders(
- DefaultValueSettingValueProvider.ProviderName,
- ConfigurationSettingValueProvider.ProviderName,
- GlobalSettingValueProvider.ProviderName,
- TenantSettingValueProvider.ProviderName),
- new SettingDefinition(
- AliyunSmsSettingNames.Sms.DefaultPhoneNumber,
- displayName: L("DisplayName:DefaultPhoneNumber"),
- description: L("Description:DefaultPhoneNumber"),
- isVisibleToClients: false
- )
- .WithProviders(
- DefaultValueSettingValueProvider.ProviderName,
- ConfigurationSettingValueProvider.ProviderName,
- GlobalSettingValueProvider.ProviderName,
- TenantSettingValueProvider.ProviderName),
- new SettingDefinition(
- AliyunSmsSettingNames.Sms.Domain,
- defaultValue: "dysmsapi.aliyuncs.com",
- displayName: L("DisplayName:Domain"),
- description: L("Description:Domain"),
- isVisibleToClients: false
- )
- .WithProviders(
- DefaultValueSettingValueProvider.ProviderName,
- ConfigurationSettingValueProvider.ProviderName,
- GlobalSettingValueProvider.ProviderName,
- TenantSettingValueProvider.ProviderName),
- new SettingDefinition(
- AliyunSmsSettingNames.Sms.Version,
- defaultValue: "2017-05-25",
- displayName: L("DisplayName:Version"),
- description: L("Description:Version"),
- isVisibleToClients: false
- )
- .WithProviders(
- DefaultValueSettingValueProvider.ProviderName,
- ConfigurationSettingValueProvider.ProviderName,
- GlobalSettingValueProvider.ProviderName,
- TenantSettingValueProvider.ProviderName),
- new SettingDefinition(
- AliyunSmsSettingNames.Sms.VisableErrorToClient,
- defaultValue: false.ToString(),
- displayName: L("DisplayName:VisableErrorToClient"),
- description: L("Description:VisableErrorToClient"),
- isVisibleToClients: false
- )
- .WithProviders(
- DefaultValueSettingValueProvider.ProviderName,
- ConfigurationSettingValueProvider.ProviderName,
- GlobalSettingValueProvider.ProviderName,
- TenantSettingValueProvider.ProviderName)
- };
- }
-
- private ILocalizableString L(string name)
- {
- return LocalizableString.Create(name);
- }
- }
-}
diff --git a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.LinkUser/FodyWeavers.xml b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.LinkUser/FodyWeavers.xml
new file mode 100644
index 000000000..c485a4548
--- /dev/null
+++ b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.LinkUser/FodyWeavers.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.LinkUser/FodyWeavers.xsd b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.LinkUser/FodyWeavers.xsd
new file mode 100644
index 000000000..11da52550
--- /dev/null
+++ b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.LinkUser/FodyWeavers.xsd
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.
+
+
+
+
+ A comma-separated list of error codes that can be safely ignored in assembly verification.
+
+
+
+
+ 'false' to turn off automatic generation of the XML Schema file.
+
+
+
+
+
\ No newline at end of file
diff --git a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.LinkUser/LINGYUN.Abp.IdentityServer.LinkUser.csproj b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.LinkUser/LINGYUN.Abp.IdentityServer.LinkUser.csproj
new file mode 100644
index 000000000..f9cbcd2cc
--- /dev/null
+++ b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.LinkUser/LINGYUN.Abp.IdentityServer.LinkUser.csproj
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+ net6.0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.LinkUser/LINGYUN/Abp/IdentityServer/LinkUser/AbpIdentityServerLinkUserModule.cs b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.LinkUser/LINGYUN/Abp/IdentityServer/LinkUser/AbpIdentityServerLinkUserModule.cs
new file mode 100644
index 000000000..b7b38faa3
--- /dev/null
+++ b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.LinkUser/LINGYUN/Abp/IdentityServer/LinkUser/AbpIdentityServerLinkUserModule.cs
@@ -0,0 +1,37 @@
+using Microsoft.Extensions.DependencyInjection;
+using Volo.Abp.IdentityServer;
+using Volo.Abp.IdentityServer.Localization;
+using Volo.Abp.Localization;
+using Volo.Abp.Modularity;
+using Volo.Abp.VirtualFileSystem;
+
+namespace LINGYUN.Abp.IdentityServer.LinkUser;
+
+[DependsOn(typeof(AbpIdentityServerDomainModule))]
+public class AbpIdentityServerLinkUserModule : AbpModule
+{
+ public override void PreConfigureServices(ServiceConfigurationContext context)
+ {
+ var configuration = context.Services.GetConfiguration();
+
+ PreConfigure(builder =>
+ {
+ builder.AddExtensionGrantValidator();
+ });
+ }
+
+ public override void ConfigureServices(ServiceConfigurationContext context)
+ {
+ Configure(options =>
+ {
+ options.FileSets.AddEmbedded();
+ });
+
+ Configure(options =>
+ {
+ options.Resources
+ .Get()
+ .AddVirtualJson("/LINGYUN/Abp/IdentityServer/LinkUser/Localization");
+ });
+ }
+}
diff --git a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.LinkUser/LINGYUN/Abp/IdentityServer/LinkUser/LinkUserGrantValidator.cs b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.LinkUser/LINGYUN/Abp/IdentityServer/LinkUser/LinkUserGrantValidator.cs
new file mode 100644
index 000000000..5a2d34b83
--- /dev/null
+++ b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.LinkUser/LINGYUN/Abp/IdentityServer/LinkUser/LinkUserGrantValidator.cs
@@ -0,0 +1,148 @@
+using IdentityServer4.Validation;
+using Microsoft.Extensions.Localization;
+using Microsoft.Extensions.Logging;
+using System;
+using System.Collections.Generic;
+using System.Security.Claims;
+using System.Threading.Tasks;
+using Volo.Abp.Identity;
+using Volo.Abp.IdentityServer.Localization;
+using Volo.Abp.MultiTenancy;
+using Volo.Abp.Security.Claims;
+using Volo.Abp.Users;
+
+namespace LINGYUN.Abp.IdentityServer.LinkUser;
+
+public class LinkUserGrantValidator : IExtensionGrantValidator
+{
+ public const string ExtensionGrantType = "link_user";
+
+ public string GrantType => ExtensionGrantType;
+
+ protected ITokenValidator TokenValidator { get; }
+ protected IdentityLinkUserManager IdentityLinkUserManager { get; }
+ protected ICurrentTenant CurrentTenant { get; }
+ protected ICurrentUser CurrentUser { get; }
+ protected ICurrentPrincipalAccessor CurrentPrincipalAccessor { get; }
+ protected IdentityUserManager UserManager { get; }
+ protected IdentitySecurityLogManager IdentitySecurityLogManager { get; }
+ protected ILogger Logger { get; }
+ protected IStringLocalizer Localizer { get; }
+
+ public LinkUserGrantValidator(
+ ITokenValidator tokenValidator,
+ IdentityLinkUserManager identityLinkUserManager,
+ ICurrentTenant currentTenant,
+ ICurrentUser currentUser,
+ IdentityUserManager userManager,
+ ICurrentPrincipalAccessor currentPrincipalAccessor,
+ IdentitySecurityLogManager identitySecurityLogManager,
+ ILogger logger,
+ IStringLocalizer localizer)
+ {
+ TokenValidator = tokenValidator;
+ IdentityLinkUserManager = identityLinkUserManager;
+ CurrentTenant = currentTenant;
+ CurrentUser = currentUser;
+ UserManager = userManager;
+ CurrentPrincipalAccessor = currentPrincipalAccessor;
+ IdentitySecurityLogManager = identitySecurityLogManager;
+ Logger = logger;
+ Localizer = localizer;
+ }
+
+ public virtual async Task ValidateAsync(ExtensionGrantValidationContext context)
+ {
+ var accessToken = context.Request.Raw["access_token"];
+ if (accessToken.IsNullOrWhiteSpace())
+ {
+ context.Result = new GrantValidationResult
+ {
+ IsError = true,
+ Error = Localizer["InvalidAccessToken"]
+ };
+ return;
+ }
+
+ var result = await TokenValidator.ValidateAccessTokenAsync(accessToken);
+ if (result.IsError)
+ {
+ context.Result = new GrantValidationResult
+ {
+ IsError = true,
+ Error = result.Error,
+ ErrorDescription = result.ErrorDescription
+ };
+ return;
+ }
+
+ using (CurrentPrincipalAccessor.Change(result.Claims))
+ {
+ if (!Guid.TryParse(context.Request.Raw["LinkUserId"], out var linkUserId))
+ {
+ context.Result = new GrantValidationResult
+ {
+ IsError = true,
+ Error = Localizer["InvalidLinkUserId"]
+ };
+ return;
+ }
+
+ Guid? linkTenantId = null;
+ if (!context.Request.Raw["LinkTenantId"].IsNullOrWhiteSpace())
+ {
+ if (!Guid.TryParse(context.Request.Raw["LinkTenantId"], out var parsedGuid))
+ {
+ context.Result = new GrantValidationResult
+ {
+ IsError = true,
+ Error = Localizer["InvalidLinkTenantId"]
+ };
+ return;
+ }
+
+ linkTenantId = parsedGuid;
+ }
+
+ var isLinked = await IdentityLinkUserManager.IsLinkedAsync(
+ new IdentityLinkUserInfo(CurrentUser.GetId(), CurrentTenant.Id),
+ new IdentityLinkUserInfo(linkUserId, linkTenantId));
+
+ if (isLinked)
+ {
+ using (CurrentTenant.Change(linkTenantId))
+ {
+ var user = await UserManager.GetByIdAsync(linkUserId);
+ var sub = await UserManager.GetUserIdAsync(user);
+
+ var additionalClaims = new List();
+ await AddCustomClaimsAsync(additionalClaims, user, context);
+
+ context.Result = new GrantValidationResult(
+ sub,
+ GrantType,
+ additionalClaims.ToArray()
+ );
+ }
+ }
+ else
+ {
+ context.Result = new GrantValidationResult
+ {
+ IsError = true,
+ Error = Localizer["TheTargetUserIsNotLinkedToYou"]
+ };
+ }
+ }
+ }
+
+ protected virtual Task AddCustomClaimsAsync(List customClaims, IdentityUser user, ExtensionGrantValidationContext context)
+ {
+ if (user.TenantId.HasValue)
+ {
+ customClaims.Add(new Claim(AbpClaimTypes.TenantId, user.TenantId?.ToString()));
+ }
+
+ return Task.CompletedTask;
+ }
+}
diff --git a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.LinkUser/LINGYUN/Abp/IdentityServer/LinkUser/Localization/en.json b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.LinkUser/LINGYUN/Abp/IdentityServer/LinkUser/Localization/en.json
new file mode 100644
index 000000000..ca74b7c0b
--- /dev/null
+++ b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.LinkUser/LINGYUN/Abp/IdentityServer/LinkUser/Localization/en.json
@@ -0,0 +1,8 @@
+{
+ "culture": "en",
+ "texts": {
+ "InvalidAccessToken": "Invalid access token.",
+ "InvalidLinkUserId": "Invalid link user id.",
+ "InvalidLinkTenantId": "Invalid link tenant id."
+ }
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.LinkUser/LINGYUN/Abp/IdentityServer/LinkUser/Localization/zh-Hans.json b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.LinkUser/LINGYUN/Abp/IdentityServer/LinkUser/Localization/zh-Hans.json
new file mode 100644
index 000000000..ad8e07adc
--- /dev/null
+++ b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.LinkUser/LINGYUN/Abp/IdentityServer/LinkUser/Localization/zh-Hans.json
@@ -0,0 +1,8 @@
+{
+ "culture": "zh-Hans",
+ "texts": {
+ "InvalidAccessToken": "无效的访问令牌.",
+ "InvalidLinkUserId": "无效的链接用户标识.",
+ "InvalidLinkTenantId": "无效的链接租户标识."
+ }
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.QQ/FodyWeavers.xml b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.QQ/FodyWeavers.xml
new file mode 100644
index 000000000..1715698cc
--- /dev/null
+++ b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.QQ/FodyWeavers.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.QQ/FodyWeavers.xsd b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.QQ/FodyWeavers.xsd
new file mode 100644
index 000000000..11da52550
--- /dev/null
+++ b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.QQ/FodyWeavers.xsd
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.
+
+
+
+
+ A comma-separated list of error codes that can be safely ignored in assembly verification.
+
+
+
+
+ 'false' to turn off automatic generation of the XML Schema file.
+
+
+
+
+
\ No newline at end of file
diff --git a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.QQ/LINGYUN.Abp.IdentityServer.QQ.csproj b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.QQ/LINGYUN.Abp.IdentityServer.QQ.csproj
new file mode 100644
index 000000000..e60fad65e
--- /dev/null
+++ b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.QQ/LINGYUN.Abp.IdentityServer.QQ.csproj
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+ net6.0
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.QQ/LINGYUN/Abp/IdentityServer/QQ/AbpIdentityServerQQConsts.cs b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.QQ/LINGYUN/Abp/IdentityServer/QQ/AbpIdentityServerQQConsts.cs
new file mode 100644
index 000000000..5ce20e964
--- /dev/null
+++ b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.QQ/LINGYUN/Abp/IdentityServer/QQ/AbpIdentityServerQQConsts.cs
@@ -0,0 +1,8 @@
+namespace LINGYUN.Abp.IdentityServer.QQ;
+
+public static class AbpIdentityServerQQConsts
+{
+ public static string AuthenticationScheme { get; set; } = "QQ Connect";
+ public static string DisplayName { get; set; } = "QQ Connect";
+ public static string CallbackPath { get; set; } = "/signin-qq";
+}
diff --git a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.QQ/LINGYUN/Abp/IdentityServer/QQ/AbpIdentityServerQQModule.cs b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.QQ/LINGYUN/Abp/IdentityServer/QQ/AbpIdentityServerQQModule.cs
new file mode 100644
index 000000000..e57f4672a
--- /dev/null
+++ b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.QQ/LINGYUN/Abp/IdentityServer/QQ/AbpIdentityServerQQModule.cs
@@ -0,0 +1,19 @@
+using LINGYUN.Abp.Tencent.QQ;
+using Microsoft.AspNetCore.Authentication;
+using Microsoft.Extensions.DependencyInjection;
+using Volo.Abp.IdentityServer;
+using Volo.Abp.Modularity;
+
+namespace LINGYUN.Abp.IdentityServer.QQ;
+
+[DependsOn(typeof(AbpTencentQQModule))]
+[DependsOn(typeof(AbpIdentityServerDomainModule))]
+public class AbpIdentityServerQQModule : AbpModule
+{
+ public override void ConfigureServices(ServiceConfigurationContext context)
+ {
+ context.Services
+ .AddAuthentication()
+ .AddQQConnect();
+ }
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.QQ/LINGYUN/Abp/IdentityServer/QQ/AbpQQClaimTypes.cs b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.QQ/LINGYUN/Abp/IdentityServer/QQ/AbpQQClaimTypes.cs
new file mode 100644
index 000000000..9b293b931
--- /dev/null
+++ b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.QQ/LINGYUN/Abp/IdentityServer/QQ/AbpQQClaimTypes.cs
@@ -0,0 +1,31 @@
+namespace LINGYUN.Abp.WeChat.Security.Claims
+{
+ ///
+ /// QQ互联身份类型,可以像 自行配置
+ ///
+ /// See:
+ ///
+ public class AbpQQClaimTypes
+ {
+ ///
+ /// 用户的唯一标识
+ ///
+ public static string OpenId { get; set; } = "qq-openid"; // 可变更
+ ///
+ /// 用户昵称
+ ///
+ public static string NickName { get; set; } = "nickname";
+ ///
+ /// 性别。 如果获取不到则默认返回"男"
+ ///
+ public static string Gender { get; set; } = "gender";
+ ///
+ /// 用户头像, 取自字段: figureurl_qq_1
+ ///
+ ///
+ /// 根据QQ互联文档, 40x40的头像是一定会存在的, 只取40x40的头像
+ /// see: https://wiki.connect.qq.com/get_user_info
+ ///
+ public static string AvatarUrl { get; set; } = "avatar";
+ }
+}
diff --git a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.QQ/Microsoft/AspNetCore/Authentication/QQ/QQConnectOAuthHandler.cs b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.QQ/Microsoft/AspNetCore/Authentication/QQ/QQConnectOAuthHandler.cs
new file mode 100644
index 000000000..2876decbb
--- /dev/null
+++ b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.QQ/Microsoft/AspNetCore/Authentication/QQ/QQConnectOAuthHandler.cs
@@ -0,0 +1,175 @@
+using LINGYUN.Abp.Tencent.QQ;
+using LINGYUN.Abp.WeChat.Security.Claims;
+using Microsoft.AspNetCore.Authentication.OAuth;
+using Microsoft.AspNetCore.WebUtilities;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using System;
+using System.Collections.Generic;
+using System.Net.Http;
+using System.Security.Claims;
+using System.Text.Encodings.Web;
+using System.Text.Json;
+using System.Threading.Tasks;
+
+namespace Microsoft.AspNetCore.Authentication.QQ
+{
+ ///
+ /// QQ互联实现
+ ///
+ public class QQConnectOAuthHandler : OAuthHandler
+ {
+ protected AbpTencentQQOptionsFactory TencentQQOptionsFactory { get; }
+ public QQConnectOAuthHandler(
+ IOptionsMonitor options,
+ AbpTencentQQOptionsFactory tencentQQOptionsFactory,
+ ILoggerFactory logger,
+ UrlEncoder encoder,
+ ISystemClock clock)
+ : base(options, logger, encoder, clock)
+ {
+ TencentQQOptionsFactory = tencentQQOptionsFactory;
+ }
+
+ protected override async Task InitializeHandlerAsync()
+ {
+ var options = await TencentQQOptionsFactory.CreateAsync();
+
+ // 用配置项重写
+ Options.ClientId = options.AppId;
+ Options.ClientSecret = options.AppKey;
+ Options.IsMobile = options.IsMobile;
+
+ await base.InitializeHandlerAsync();
+ }
+
+ ///
+ /// 构建用户授权地址
+ ///
+ protected override string BuildChallengeUrl(AuthenticationProperties properties, string redirectUri)
+ {
+ var challengeUrl = base.BuildChallengeUrl(properties, redirectUri);
+ if (Options.IsMobile)
+ {
+ challengeUrl += "&display=mobile";
+ }
+ return challengeUrl;
+ }
+
+ ///
+ /// code换取access_token
+ ///
+ protected override async Task ExchangeCodeAsync(OAuthCodeExchangeContext context)
+ {
+ var address = QueryHelpers.AddQueryString(Options.TokenEndpoint, new Dictionary()
+ {
+ { "client_id", Options.ClientId },
+ { "redirect_uri", context.RedirectUri },
+ { "client_secret", Options.ClientSecret},
+ { "code", context.Code},
+ { "grant_type","authorization_code"}
+ });
+
+ var response = await Backchannel.GetAsync(address);
+ if (!response.IsSuccessStatusCode)
+ {
+ Logger.LogError("An error occurred while retrieving an access token: the remote server " +
+ "returned a {Status} response with the following payload: {Headers} {Body}.",
+ /* Status: */ response.StatusCode,
+ /* Headers: */ response.Headers.ToString(),
+ /* Body: */ await response.Content.ReadAsStringAsync());
+
+ return OAuthTokenResponse.Failed(new Exception("An error occurred while retrieving an access token."));
+ }
+
+ var payload = JsonDocument.Parse(await response.Content.ReadAsStringAsync());
+ if (!string.IsNullOrEmpty(payload.GetRootString("errcode")))
+ {
+ Logger.LogError("An error occurred while retrieving an access token: the remote server " +
+ "returned a {Status} response with the following payload: {Headers} {Body}.",
+ /* Status: */ response.StatusCode,
+ /* Headers: */ response.Headers.ToString(),
+ /* Body: */ await response.Content.ReadAsStringAsync());
+
+ return OAuthTokenResponse.Failed(new Exception("An error occurred while retrieving an access token."));
+ }
+ return OAuthTokenResponse.Success(payload);
+ }
+
+ protected override async Task CreateTicketAsync(ClaimsIdentity identity, AuthenticationProperties properties, OAuthTokenResponse tokens)
+ {
+ var openIdEndpoint = Options.OpenIdEndpoint + "?access_token=" + tokens.AccessToken + "&fmt=json";
+ var openIdResponse = await Backchannel.GetAsync(openIdEndpoint, Context.RequestAborted);
+ openIdResponse.EnsureSuccessStatusCode();
+
+ var openIdPayload = JsonDocument.Parse(await openIdResponse.Content.ReadAsStringAsync());
+ var openId = openIdPayload.GetRootString("openid");
+
+ identity.AddClaim(new Claim(AbpQQClaimTypes.OpenId, openId, ClaimValueTypes.String, Options.ClaimsIssuer));
+
+ var address = QueryHelpers.AddQueryString(Options.UserInformationEndpoint, new Dictionary
+ {
+ {"oauth_consumer_key", Options.ClientId},
+ {"access_token", tokens.AccessToken},
+ {"openid", openId}
+ });
+
+ var response = await Backchannel.GetAsync(address);
+ if (!response.IsSuccessStatusCode)
+ {
+ Logger.LogError("An error occurred while retrieving the user profile: the remote server " +
+ "returned a {Status} response with the following payload: {Headers} {Body}.",
+ /* Status: */ response.StatusCode,
+ /* Headers: */ response.Headers.ToString(),
+ /* Body: */ await response.Content.ReadAsStringAsync());
+
+ throw new HttpRequestException("An error occurred while retrieving user information.");
+ }
+
+ var userInfoPayload = JsonDocument.Parse(await response.Content.ReadAsStringAsync());
+ var errorCode = userInfoPayload.GetRootString("ret");
+ if (!"0".Equals(errorCode))
+ {
+ // See: https://wiki.connect.qq.com/%e5%85%ac%e5%85%b1%e8%bf%94%e5%9b%9e%e7%a0%81%e8%af%b4%e6%98%8e
+ Logger.LogError("An error occurred while retrieving the user profile: the remote server " +
+ "returned code {Code} response with message: {Message}.",
+ errorCode,
+ userInfoPayload.GetRootString("msg"));
+
+ throw new HttpRequestException("An error occurred while retrieving user information.");
+ }
+
+ var nickName = userInfoPayload.GetRootString("nickname");
+ if (!nickName.IsNullOrWhiteSpace())
+ {
+ identity.AddClaim(new Claim(AbpQQClaimTypes.NickName, nickName, ClaimValueTypes.String, Options.ClaimsIssuer));
+ }
+ var gender = userInfoPayload.GetRootString("gender");
+ if (!gender.IsNullOrWhiteSpace())
+ {
+ identity.AddClaim(new Claim(AbpQQClaimTypes.Gender, gender, ClaimValueTypes.String, Options.ClaimsIssuer));
+ }
+ var avatarUrl = userInfoPayload.GetRootString("figureurl_qq_1");
+ if (!avatarUrl.IsNullOrWhiteSpace())
+ {
+ identity.AddClaim(new Claim(AbpQQClaimTypes.AvatarUrl, avatarUrl, ClaimValueTypes.String, Options.ClaimsIssuer));
+ }
+
+ var context = new OAuthCreatingTicketContext(
+ new ClaimsPrincipal(identity),
+ properties,
+ Context,
+ Scheme,
+ Options,
+ Backchannel,
+ tokens,
+ userInfoPayload.RootElement);
+
+ context.RunClaimActions();
+
+ await Events.CreatingTicket(context);
+
+ return new AuthenticationTicket(context.Principal, context.Properties, Scheme.Name);
+ }
+ }
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.QQ/Microsoft/AspNetCore/Authentication/QQ/QQConnectOAuthOptions.cs b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.QQ/Microsoft/AspNetCore/Authentication/QQ/QQConnectOAuthOptions.cs
new file mode 100644
index 000000000..b650bc517
--- /dev/null
+++ b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.QQ/Microsoft/AspNetCore/Authentication/QQ/QQConnectOAuthOptions.cs
@@ -0,0 +1,47 @@
+using LINGYUN.Abp.IdentityServer.QQ;
+using LINGYUN.Abp.WeChat.Security.Claims;
+using Microsoft.AspNetCore.Authentication.OAuth;
+using Microsoft.AspNetCore.Http;
+using System.Security.Claims;
+
+namespace Microsoft.AspNetCore.Authentication.QQ
+{
+ public class QQConnectOAuthOptions : OAuthOptions
+ {
+ ///
+ /// 是否移动端样式
+ ///
+ public bool IsMobile { get; set; }
+ ///
+ /// 获取用户OpenID_OAuth2.0
+ ///
+ public string OpenIdEndpoint { get; set; }
+
+ public QQConnectOAuthOptions()
+ {
+ // 用于防止初始化错误,会在OAuthHandler.InitializeHandlerAsync中进行重写
+ ClientId = "QQConnect";
+ ClientSecret = "QQConnect";
+
+ ClaimsIssuer = "connect.qq.com";
+ CallbackPath = new PathString(AbpIdentityServerQQConsts.CallbackPath);
+
+ AuthorizationEndpoint = "https://graph.qq.com/oauth2.0/authorize";
+ TokenEndpoint = "https://graph.qq.com/oauth2.0/token";
+ OpenIdEndpoint = "https://graph.qq.com/oauth2.0/me";
+ UserInformationEndpoint = "https://graph.qq.com/user/get_user_info";
+
+ Scope.Add("get_user_info");
+
+ // 这个原始的属性一定要写进去,框架关联判断是否绑定QQ
+ ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "openid");
+ ClaimActions.MapJsonKey(ClaimTypes.Name, "nickname");
+
+ // 把自定义的身份标识写进令牌
+ ClaimActions.MapJsonKey(AbpQQClaimTypes.OpenId, "openid");
+ ClaimActions.MapJsonKey(AbpQQClaimTypes.NickName, "nickname");
+ ClaimActions.MapJsonKey(AbpQQClaimTypes.Gender, "gender");
+ ClaimActions.MapJsonKey(AbpQQClaimTypes.AvatarUrl, "figureurl_qq_1");
+ }
+ }
+}
diff --git a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.QQ/Microsoft/AspNetCore/Authentication/QQAuthenticationExtensions.cs b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.QQ/Microsoft/AspNetCore/Authentication/QQAuthenticationExtensions.cs
new file mode 100644
index 000000000..579b1cb16
--- /dev/null
+++ b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.QQ/Microsoft/AspNetCore/Authentication/QQAuthenticationExtensions.cs
@@ -0,0 +1,63 @@
+using LINGYUN.Abp.IdentityServer.QQ;
+using Microsoft.AspNetCore.Authentication.QQ;
+using Microsoft.Extensions.DependencyInjection;
+using System;
+
+namespace Microsoft.AspNetCore.Authentication
+{
+ public static class QQAuthenticationExtensions
+ {
+ ///
+ ///
+ public static AuthenticationBuilder AddQQConnect(
+ this AuthenticationBuilder builder)
+ {
+ return builder
+ .AddQQConnect(
+ AbpIdentityServerQQConsts.AuthenticationScheme,
+ AbpIdentityServerQQConsts.DisplayName,
+ options => { });
+ }
+
+ ///
+ ///
+ public static AuthenticationBuilder AddQQConnect(
+ this AuthenticationBuilder builder,
+ Action configureOptions)
+ {
+ return builder
+ .AddQQConnect(
+ AbpIdentityServerQQConsts.AuthenticationScheme,
+ configureOptions);
+ }
+
+ ///
+ ///
+ public static AuthenticationBuilder AddQQConnect(
+ this AuthenticationBuilder builder,
+ string authenticationScheme,
+ Action configureOptions)
+ {
+ return builder
+ .AddQQConnect(
+ authenticationScheme,
+ AbpIdentityServerQQConsts.DisplayName,
+ configureOptions);
+ }
+
+ ///
+ ///
+ public static AuthenticationBuilder AddQQConnect(
+ this AuthenticationBuilder builder,
+ string authenticationScheme,
+ string displayName,
+ Action configureOptions)
+ {
+ return builder
+ .AddOAuth(
+ authenticationScheme,
+ displayName,
+ configureOptions);
+ }
+ }
+}
diff --git a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.QQ/System/BytesExtensions.cs b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.QQ/System/BytesExtensions.cs
new file mode 100644
index 000000000..d1bad7915
--- /dev/null
+++ b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.QQ/System/BytesExtensions.cs
@@ -0,0 +1,16 @@
+using System.Security.Cryptography;
+
+namespace System
+{
+ internal static class BytesExtensions
+ {
+ public static byte[] Sha1(this byte[] data)
+ {
+ using (var sha = SHA1.Create())
+ {
+ var hashBytes = sha.ComputeHash(data);
+ return hashBytes;
+ }
+ }
+ }
+}
diff --git a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.QQ/System/StringExtensions.cs b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.QQ/System/StringExtensions.cs
new file mode 100644
index 000000000..a8eb40c27
--- /dev/null
+++ b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.QQ/System/StringExtensions.cs
@@ -0,0 +1,17 @@
+using System.Security.Cryptography;
+using System.Text;
+
+namespace System
+{
+ internal static class StringExtensions
+ {
+ public static byte[] Sha1(this string str)
+ {
+ using (var sha = SHA1.Create())
+ {
+ var hashBytes = sha.ComputeHash(Encoding.ASCII.GetBytes(str));
+ return hashBytes;
+ }
+ }
+ }
+}
diff --git a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.QQ/System/Text/Json/JsonElementExtensions.cs b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.QQ/System/Text/Json/JsonElementExtensions.cs
new file mode 100644
index 000000000..653a868ac
--- /dev/null
+++ b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.QQ/System/Text/Json/JsonElementExtensions.cs
@@ -0,0 +1,63 @@
+using System.Collections.Generic;
+
+namespace System.Text.Json
+{
+ internal static class JsonElementExtensions
+ {
+ public static IEnumerable GetRootStrings(this JsonDocument json, string key)
+ {
+ return json.RootElement.GetStrings(key);
+ }
+
+ public static IEnumerable GetStrings(this JsonElement json, string key)
+ {
+ var result = new List();
+
+ if (json.TryGetProperty(key, out JsonElement property) && property.ValueKind == JsonValueKind.Array)
+ {
+ foreach (var jsonProp in property.EnumerateArray())
+ {
+ result.Add(jsonProp.GetString());
+ }
+ }
+
+ return result;
+ }
+
+ public static string GetRootString(this JsonDocument json, string key, string defaultValue = "")
+ {
+ if (json.RootElement.TryGetProperty(key, out JsonElement property))
+ {
+ return property.GetString();
+ }
+ return defaultValue;
+ }
+
+ public static string GetString(this JsonElement json, string key, string defaultValue = "")
+ {
+ if (json.TryGetProperty(key, out JsonElement property))
+ {
+ return property.GetString();
+ }
+ return defaultValue;
+ }
+
+ public static int GetRootInt32(this JsonDocument json, string key, int defaultValue = 0)
+ {
+ if (json.RootElement.TryGetProperty(key, out JsonElement property) && property.TryGetInt32(out int value))
+ {
+ return value;
+ }
+ return defaultValue;
+ }
+
+ public static int GetInt32(this JsonElement json, string key, int defaultValue = 0)
+ {
+ if (json.TryGetProperty(key, out JsonElement property) && property.TryGetInt32(out int value))
+ {
+ return value;
+ }
+ return defaultValue;
+ }
+ }
+}
diff --git a/aspnet-core/services/LY.MicroService.identityServer/IdentityServerModule.cs b/aspnet-core/services/LY.MicroService.identityServer/IdentityServerModule.cs
index b433dce5a..ee4118123 100644
--- a/aspnet-core/services/LY.MicroService.identityServer/IdentityServerModule.cs
+++ b/aspnet-core/services/LY.MicroService.identityServer/IdentityServerModule.cs
@@ -5,6 +5,7 @@ using LINGYUN.Abp.EventBus.CAP;
using LINGYUN.Abp.Identity.EntityFrameworkCore;
using LINGYUN.Abp.IdentityServer;
using LINGYUN.Abp.IdentityServer.EntityFrameworkCore;
+using LINGYUN.Abp.IdentityServer.QQ;
using LINGYUN.Abp.IdentityServer.WeChat;
using LINGYUN.Abp.Localization.CultureMap;
using LINGYUN.Abp.MultiTenancy.DbFinder;
@@ -52,6 +53,7 @@ namespace LY.MicroService.IdentityServer;
typeof(AbpIdentityServerEntityFrameworkCoreModule),
typeof(AbpIdentityServerSmsValidatorModule),
typeof(AbpIdentityServerWeChatModule),
+ typeof(AbpIdentityServerQQModule),
typeof(AbpPermissionManagementDomainIdentityModule),
typeof(AbpPermissionManagementEntityFrameworkCoreModule),
typeof(AbpSettingManagementEntityFrameworkCoreModule),
diff --git a/aspnet-core/services/LY.MicroService.identityServer/LY.MicroService.IdentityServer.csproj b/aspnet-core/services/LY.MicroService.identityServer/LY.MicroService.IdentityServer.csproj
index 10ce6782d..aa60d636a 100644
--- a/aspnet-core/services/LY.MicroService.identityServer/LY.MicroService.IdentityServer.csproj
+++ b/aspnet-core/services/LY.MicroService.identityServer/LY.MicroService.IdentityServer.csproj
@@ -52,6 +52,7 @@
+
diff --git a/aspnet-core/services/LY.MicroService.identityServer/Properties/launchSettings.json b/aspnet-core/services/LY.MicroService.identityServer/Properties/launchSettings.json
index 8dc370b4f..e6efe3743 100644
--- a/aspnet-core/services/LY.MicroService.identityServer/Properties/launchSettings.json
+++ b/aspnet-core/services/LY.MicroService.identityServer/Properties/launchSettings.json
@@ -12,7 +12,7 @@
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": false,
- "applicationUrl": "http://127.0.0.1:44385;https://localhost:44386",
+ "applicationUrl": "http://127.0.0.1:44385;https://127.0.0.1:44386",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
diff --git a/build/modules.dependencies.json b/build/modules.dependencies.json
index 240d6e18c..e550bd2fa 100644
--- a/build/modules.dependencies.json
+++ b/build/modules.dependencies.json
@@ -24,7 +24,10 @@
"LINGYUN.Abp.RealTime.dll",
"LINGYUN.Abp.Notifications.dll",
"LINGYUN.Platform.Application.Contracts.dll",
- "LINGYUN.Platform.Domain.Shared.dll"
+ "LINGYUN.Platform.Domain.Shared.dll",
+ "LINGYUN.Abp.Tencent.dll",
+ "LINGYUN.Abp.Tencent.QQ.dll",
+ "LINGYUN.Abp.Tencent.SettingManagement.dll"
]
},
{