😎修复数据库连接字符串加解密sm2对应

This commit is contained in:
zuohuaijun 2025-06-15 02:57:14 +08:00
parent babe0280e3
commit 4c71084e63
3 changed files with 3 additions and 3 deletions

View File

@ -83,7 +83,7 @@ public sealed class DbSettings
public bool EnableUnderLine { get; set; }
/// <summary>
/// 启用数据库连接串加密策略
/// 启用数据库连接串加密策略国密SM2加解密
/// </summary>
public bool EnableConnEncrypt { get; set; }
}

View File

@ -73,7 +73,7 @@ public static class SqlSugarSetup
{
// 解密数据库连接串
if (config.DbSettings.EnableConnEncrypt)
config.ConnectionString = CryptogramUtil.Decrypt(config.ConnectionString);
config.ConnectionString = CryptogramUtil.SM2Decrypt(config.ConnectionString);
// SqlFunc 扩展函数
var sqlFuncServices = new List<SqlFuncExternal>

View File

@ -525,7 +525,7 @@ public static class CommonUtil
var ipInfo = IpTool.SearchWithI18N(ip); // 国际化查询,默认中文 中文zh-CN、英文en
var addressList = new List<string>() { ipInfo.Country, ipInfo.Province, ipInfo.City, ipInfo.NetworkOperator };
var location = string.Join(" ", addressList.Where(u => u != "0" && !string.IsNullOrWhiteSpace(u)).ToList()); // 去掉0及空并用空格连接
if (string.IsNullOrWhiteSpace(location)) location = "本地";
if (string.IsNullOrWhiteSpace(location)) location = "未知";
return (location, ipInfo.Longitude, ipInfo.Latitude);
}
catch