diff --git a/YD_Event.Application/applicationsettings.json b/YD_Event.Application/applicationsettings.json index d24934a..f990450 100644 --- a/YD_Event.Application/applicationsettings.json +++ b/YD_Event.Application/applicationsettings.json @@ -39,9 +39,9 @@ //"DbType": "MySql", // MySql、SqlServer、Sqlite、Oracle、PostgreSQL、Dm、Kdbndp、Oscar、MySqlConnector、Access、OpenGauss、QuestDB、HG、ClickHouse、GBase、Odbc、Custom //"ConnectionString": "Server=127.0.0.1;User Id=root;Password=123456;Port=3306;Database=YD_Event;CharSet=utf8mb4;", "DbType": "SqlServer", // MySql、SqlServer、Sqlite、Oracle、PostgreSQL、Dm、Kdbndp、Oscar、MySqlConnector、Access、OpenGauss、QuestDB、HG、ClickHouse、GBase、Odbc、Custom - "ConnectionString": "Data Source=rm-uf64b8oxdt19pfyxfao.sqlserver.rds.aliyuncs.com;Database=EventServerDB_QA;User ID=qa;Password=Admin@123;Connect Timeout=500;", + "ConnectionString": "Data Source=rm-uf64b8oxdt19pfyxfao.sqlserver.rds.aliyuncs.com;Database=EventServerDB_QA;User ID=qa;Password=Admin@123;Connect Timeout=500;Encrypt=True;TrustServerCertificate=True;", "IsAutoCloseConnection": true, - "EnableInitDb": false // 启用数据库以及数据表初始化(首次运行项目时开启可以自动创建数据库和初始化项目运行的基础数据) + "EnableInitDb": true // 启用数据库以及数据表初始化(首次运行项目时开启可以自动创建数据库和初始化项目运行的基础数据) } ] }, diff --git a/YD_Event.Core/InitData/sysuser.txt b/YD_Event.Core/InitData/sysuser.txt new file mode 100644 index 0000000..0ee9628 --- /dev/null +++ b/YD_Event.Core/InitData/sysuser.txt @@ -0,0 +1,32 @@ +[ + { + "Id": 1, + "Account": "admin", + "Password": "9658b68df5e6208e97ae6c8f4eac6c39", + "Name": "管理员", + "Gender": 2, + "NickName": "管理员", + "Avatar": "https://oss.okay123.top/oss//2023/07/13/Yln0lzZQLN.jpg", + "OrgId": 68411661271045, + "Status": 0, + "CreatedUserId": 1, + "DeleteMark": false, + "CreatedTime": "2023-06-01T00:00:00", + "UpdatedTime": "2023-06-01T00:00:00" + }, + { + "Id": 50048753934341, + "Account": "test", + "Password": "65caa9533b8d9f336bd07919dd9bf74e", + "Name": "测试", + "Gender": 2, + "NickName": "测试", + "Avatar": null, + "OrgId": 68411661271045, + "Status": 0, + "CreatedUserId": 1, + "DeleteMark": false, + "CreatedTime": "2023-06-01T00:00:00", + "UpdatedTime": "2023-06-01T00:00:00" + } +] \ No newline at end of file diff --git a/YD_Event.Core/SqlSugar/SqlSugarExtensions.cs b/YD_Event.Core/SqlSugar/SqlSugarExtensions.cs index c9d6b33..0c21d38 100644 --- a/YD_Event.Core/SqlSugar/SqlSugarExtensions.cs +++ b/YD_Event.Core/SqlSugar/SqlSugarExtensions.cs @@ -181,32 +181,6 @@ public static class SqlSugarExtensions /// private static void InitData(SqlSugarScope client) { - List users = new List() - { - new SysUser() - { - Id = 1, - Account = "admin", - Password = "9658b68df5e6208e97ae6c8f4eac6c39", - Name = "管理员", - Gender = Gender.Female, - NickName = "管理员", - Avatar = "https://oss.okay123.top/oss//2023/07/13/Yln0lzZQLN.jpg", - CreatedUserId = 1 - }, - new SysUser() - { - Id = 50048753934341, - Account = "test", - Password = "65caa9533b8d9f336bd07919dd9bf74e", - Name = "测试", - Gender = Gender.Female, - NickName = "测试", - CreatedUserId = 1 - } - }; - client.Storageable(users).ToStorage().AsInsertable.ExecuteCommand(); - string path = Path.Combine(AppContext.BaseDirectory, "InitData"); var dir = new DirectoryInfo(path); var files = dir.GetFiles("*.txt"); diff --git a/YD_Event.Web.Entry/appsettings.json b/YD_Event.Web.Entry/appsettings.json index 27baf74..52b1a4e 100644 --- a/YD_Event.Web.Entry/appsettings.json +++ b/YD_Event.Web.Entry/appsettings.json @@ -10,7 +10,7 @@ "AllowedHosts": "*", "ConnectionConfigs": [ { - "ConnectionString": "Data Source=rm-uf64b8oxdt19pfyxfao.sqlserver.rds.aliyuncs.com;Database=EventServerDB_QA;User ID=qa;Password=Admin@123;Connect Timeout=500;", + "ConnectionString": "Data Source=rm-uf64b8oxdt19pfyxfao.sqlserver.rds.aliyuncs.com;Database=EventServerDB_QA;User ID=qa;Password=Admin@123;Connect Timeout=500;Encrypt=True;TrustServerCertificate=True;", "DbType": "SqlServer", "IsAutoCloseConnection": true }