Browse Source

添加只读连接模式

lcl 1 year ago
parent
commit
58f8a5aa1b
3 changed files with 3 additions and 1 deletions
  1. 1 1
      AppStart/Helper/ExportService.cs
  2. 1 0
      Config/MysqlConn.cs
  3. 1 0
      appsettings.json

+ 1 - 1
AppStart/Helper/ExportService.cs

@@ -87,7 +87,7 @@ namespace MySystem
                 int skip = page * pageSize;
                 string sql = SqlString + " limit " + skip + "," + pageSize;
                 function.WriteLog(sql, "导出日志");
-                DataTable dt = CustomerSqlConn.dtable(sql, MysqlConn.connstr);
+                DataTable dt = CustomerSqlConn.dtable(sql, MysqlConn.readconnstr);
                 if(dt.Rows.Count > 0)
                 {
                     foreach (DataRow dr in dt.Rows)

+ 1 - 0
Config/MysqlConn.cs

@@ -7,6 +7,7 @@ namespace MySystem
     public class MysqlConn
     {
         public static string connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
+        public static string readconnstr = Library.ConfigurationManager.AppSettings["ReadSqlConnStr"].ToString();
         public static string sourceHost = Library.ConfigurationManager.AppSettings["SourceHost"].ToString();
 
     }

+ 1 - 0
appsettings.json

@@ -18,6 +18,7 @@
     "SourceHost": "http://test.export.kexiaoshuang.com/",
     "Database": "KxsExportServer",
     "SqlConnStr": "server=47.109.31.237;port=3306;user=KxsMainServer;password=FrW8ZfxlcaVdm1r0;database=KxsMainServer;charset=utf8;",
+    "ReadSqlConnStr": "server=47.109.31.237;port=3306;user=KxsMainServer;password=FrW8ZfxlcaVdm1r0;database=KxsMainServer;charset=utf8;",
     "RedisConnStr": "47.109.31.237:6379,password=klm@redis,DefaultDatabase=1,poolsize=500,preheat=50,asyncPipeline=true",
     "IOSAppVersion": "1.0.0",
     "AndroidAppVersion": "1.0.0",