lichunlei 4 лет назад
Родитель
Сommit
491c95d3fe

+ 16 - 16
Areas/Admin/Controllers/BsServer/MsgPersonalController.cs

@@ -12,7 +12,7 @@ using Microsoft.AspNetCore.Mvc;
 using Microsoft.AspNetCore.Http;
 using Microsoft.Extensions.Logging;
 using Microsoft.Extensions.Options;
-using MySystem.BsModels;
+using MySystem.Models;
 using Library;
 using LitJson;
 using MySystemLib;
@@ -25,7 +25,7 @@ namespace MySystem.Areas.Admin.Controllers
     {
         public MsgPersonalController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
         {
-            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["BsSqlConnStr"].ToString();
+            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
         }
 
         #region 个人消息列表
@@ -82,7 +82,7 @@ namespace MySystem.Areas.Admin.Controllers
                 condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
             }
 
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).IndexData("MsgPersonal", Fields, "Id desc", "0", page, limit, condition);
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("MsgPersonal", Fields, "Id desc", "0", page, limit, condition);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
             foreach (Dictionary<string, object> dic in diclist)
             {
@@ -153,7 +153,7 @@ namespace MySystem.Areas.Admin.Controllers
                     Fields.Add("PushFlag", data.PushFlag); //推送标记
                     Fields.Add("Remark", data.Remark); //备注
                     Fields.Add("Status", 1);
-                    int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Add("MsgPersonal", Fields, 0);
+                    int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("MsgPersonal", Fields, 0);
                     AddSysLog(data.Id.ToString(), "MsgPersonal", "add");
                     bsdb.SaveChanges();
                     SetRedis(Id);
@@ -184,7 +184,7 @@ namespace MySystem.Areas.Admin.Controllers
                                 Fields.Add("PushFlag", data.PushFlag); //推送标记
                                 Fields.Add("Remark", data.Remark); //备注
                                 Fields.Add("Status", 1);
-                                int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Add("MsgPersonal", Fields, 0);
+                                int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("MsgPersonal", Fields, 0);
                                 AddSysLog(data.Id.ToString(), "MsgPersonal", "add");
                                 bsdb.SaveChanges();
                                 SetRedis(Id);
@@ -215,7 +215,7 @@ namespace MySystem.Areas.Admin.Controllers
             ViewBag.right = right;
 
 
-            MsgPersonal editData = bsdb.MsgPersonal.FirstOrDefault(m => m.Id == Id) ?? new MsgPersonal();
+            MsgPersonal editData = db.MsgPersonal.FirstOrDefault(m => m.Id == Id) ?? new MsgPersonal();
             ViewBag.data = editData;
             return View();
         }
@@ -250,7 +250,7 @@ namespace MySystem.Areas.Admin.Controllers
             Fields.Add("SeoTitle", data.SeoTitle);
             Fields.Add("SeoKeyword", data.SeoKeyword);
             Fields.Add("SeoDescription", data.SeoDescription);
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Edit("MsgPersonal", Fields, data.Id);
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("MsgPersonal", Fields, data.Id);
             AddSysLog(data.Id.ToString(), "MsgPersonal", "update");
             bsdb.SaveChanges();
             SetRedis(data.Id, "edit");
@@ -275,7 +275,7 @@ namespace MySystem.Areas.Admin.Controllers
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", -1);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Edit("MsgPersonal", Fields, id);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("MsgPersonal", Fields, id);
             }
             bsdb.SaveChanges();
 
@@ -299,7 +299,7 @@ namespace MySystem.Areas.Admin.Controllers
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("PushFlag", 1);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Edit("MsgPersonal", Fields, id);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("MsgPersonal", Fields, id);
             }
             bsdb.SaveChanges();
             return "success";
@@ -322,7 +322,7 @@ namespace MySystem.Areas.Admin.Controllers
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", 1);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Edit("MsgPersonal", Fields, id);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("MsgPersonal", Fields, id);
             }
             bsdb.SaveChanges();
             return "success";
@@ -345,7 +345,7 @@ namespace MySystem.Areas.Admin.Controllers
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", 0);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Edit("MsgPersonal", Fields, id);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("MsgPersonal", Fields, id);
             }
             bsdb.SaveChanges();
             return "success";
@@ -360,7 +360,7 @@ namespace MySystem.Areas.Admin.Controllers
         /// <param name="Id"></param>
         public string Sort(int Id, int Sort)
         {
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Sort("MsgPersonal", Sort, Id);
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("MsgPersonal", Sort, Id);
 
             AddSysLog(Id.ToString(), "MsgPersonal", "sort");
             return "success";
@@ -380,13 +380,13 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 JsonData dr = list[i];
 
-                bsdb.MsgPersonal.Add(new MsgPersonal()
+                db.MsgPersonal.Add(new MsgPersonal()
                 {
                     CreateDate = DateTime.Now,
                     UpdateDate = DateTime.Now,
 
                 });
-                bsdb.SaveChanges();
+                db.SaveChanges();
             }
             AddSysLog("0", "MsgPersonal", "Import");
             return "success";
@@ -406,7 +406,7 @@ namespace MySystem.Areas.Admin.Controllers
             Fields.Add("Title", "2"); //标题
             Fields.Add("ReadFlag", "1"); //已读标记
 
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).IndexData("MsgPersonal", Fields, "Id desc", "0", 1, 20000, "", "", false);
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("MsgPersonal", Fields, "Id desc", "0", 1, 20000, "", "", false);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
             foreach (Dictionary<string, object> dic in diclist)
             {
@@ -434,7 +434,7 @@ namespace MySystem.Areas.Admin.Controllers
 
         private void SetRedis(int Id, string EditType = "add")
         {
-            MsgPersonal msg = bsdb.MsgPersonal.FirstOrDefault(m => m.Id == Id);
+            MsgPersonal msg = db.MsgPersonal.FirstOrDefault(m => m.Id == Id);
             if (msg != null)
             {
                 if (EditType == "add")

+ 21 - 21
Areas/Admin/Controllers/BsServer/MsgPlacardController.cs

@@ -12,7 +12,7 @@ using Microsoft.AspNetCore.Mvc;
 using Microsoft.AspNetCore.Http;
 using Microsoft.Extensions.Logging;
 using Microsoft.Extensions.Options;
-using MySystem.BsModels;
+using MySystem.Models;
 using Library;
 using LitJson;
 using MySystemLib;
@@ -25,7 +25,7 @@ namespace MySystem.Areas.Admin.Controllers
     {
         public MsgPlacardController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
         {
-            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["BsSqlConnStr"].ToString();
+            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
         }
 
         #region 公告消息列表
@@ -86,7 +86,7 @@ namespace MySystem.Areas.Admin.Controllers
                 condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
             }
 
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).IndexData("MsgPlacard", Fields, "Id desc", "0", page, limit, condition);
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("MsgPlacard", Fields, "Id desc", "0", page, limit, condition);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
             foreach (Dictionary<string, object> dic in diclist)
             {
@@ -160,9 +160,9 @@ namespace MySystem.Areas.Admin.Controllers
             Fields.Add("SeoTitle", data.SeoTitle);
             Fields.Add("SeoKeyword", data.SeoKeyword);
             Fields.Add("SeoDescription", data.SeoDescription);
-            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Add("MsgPlacard", Fields, 0);
+            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("MsgPlacard", Fields, 0);
             AddSysLog(Id.ToString(), "MsgPlacard", "add");
-            bsdb.SaveChanges();
+            db.SaveChanges();
 
             SetRedis(Id, true);
 
@@ -191,7 +191,7 @@ namespace MySystem.Areas.Admin.Controllers
             ViewBag.right = right;
 
 
-            MsgPlacard editData = bsdb.MsgPlacard.FirstOrDefault(m => m.Id == Id) ?? new MsgPlacard();
+            MsgPlacard editData = db.MsgPlacard.FirstOrDefault(m => m.Id == Id) ?? new MsgPlacard();
             ViewBag.data = editData;
             return View();
         }
@@ -228,9 +228,9 @@ namespace MySystem.Areas.Admin.Controllers
             Fields.Add("SeoTitle", data.SeoTitle);
             Fields.Add("SeoKeyword", data.SeoKeyword);
             Fields.Add("SeoDescription", data.SeoDescription);
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Edit("MsgPlacard", Fields, data.Id);
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("MsgPlacard", Fields, data.Id);
             AddSysLog(data.Id.ToString(), "MsgPlacard", "update");
-            bsdb.SaveChanges();
+            db.SaveChanges();
             
             SetRedis(data.Id, true);
 
@@ -246,7 +246,7 @@ namespace MySystem.Areas.Admin.Controllers
             ViewBag.RightInfo = RightInfo;
             ViewBag.right = right;
 
-            MsgPlacard editData = bsdb.MsgPlacard.FirstOrDefault(m => m.Id == Id) ?? new MsgPlacard();
+            MsgPlacard editData = db.MsgPlacard.FirstOrDefault(m => m.Id == Id) ?? new MsgPlacard();
             ViewBag.data = editData;
             return View();
         }
@@ -268,10 +268,10 @@ namespace MySystem.Areas.Admin.Controllers
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", -1);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Edit("MsgPlacard", Fields, id);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("MsgPlacard", Fields, id);
                 SetRedis(0, true);
             }
-            bsdb.SaveChanges();
+            db.SaveChanges();
 
             return "success";
         }
@@ -293,9 +293,9 @@ namespace MySystem.Areas.Admin.Controllers
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", 1);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Edit("MsgPlacard", Fields, id);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("MsgPlacard", Fields, id);
             }
-            bsdb.SaveChanges();
+            db.SaveChanges();
             return "success";
         }
 
@@ -316,9 +316,9 @@ namespace MySystem.Areas.Admin.Controllers
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", 0);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Edit("MsgPlacard", Fields, id);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("MsgPlacard", Fields, id);
             }
-            bsdb.SaveChanges();
+            db.SaveChanges();
             return "success";
         }
 
@@ -331,7 +331,7 @@ namespace MySystem.Areas.Admin.Controllers
         /// <param name="Id"></param>
         public string Sort(int Id, int Sort)
         {
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Sort("MsgPlacard", Sort, Id);
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("MsgPlacard", Sort, Id);
 
             AddSysLog(Id.ToString(), "MsgPlacard", "sort");
             return "success";
@@ -351,13 +351,13 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 JsonData dr = list[i];
 
-                bsdb.MsgPlacard.Add(new MsgPlacard()
+                db.MsgPlacard.Add(new MsgPlacard()
                 {
                     CreateDate = DateTime.Now,
                     UpdateDate = DateTime.Now,
 
                 });
-                bsdb.SaveChanges();
+                db.SaveChanges();
             }
             AddSysLog("0", "MsgPlacard", "Import");
             return "success";
@@ -379,7 +379,7 @@ namespace MySystem.Areas.Admin.Controllers
             Fields.Add("PushType", "1"); //推送类型
             Fields.Add("PushFlag", "1"); //推送标记
 
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).IndexData("MsgPlacard", Fields, "Id desc", "0", 1, 20000, "", "", false);
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("MsgPlacard", Fields, "Id desc", "0", 1, 20000, "", "", false);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
             foreach (Dictionary<string, object> dic in diclist)
             {
@@ -409,7 +409,7 @@ namespace MySystem.Areas.Admin.Controllers
             if (All)
             {
                 RedisDbconn.Instance.Clear("MsgPlacardList");
-                var msgs = bsdb.MsgPlacard.Select(m => new { m.Id, m.Status, m.Sort }).Where(m => m.Status > -1).OrderByDescending(m => m.Sort).ThenByDescending(m => m.Id).ToList();
+                var msgs = db.MsgPlacard.Select(m => new { m.Id, m.Status, m.Sort }).Where(m => m.Status > -1).OrderByDescending(m => m.Sort).ThenByDescending(m => m.Id).ToList();
                 foreach (var msg in msgs)
                 {
                     RedisDbconn.Instance.AddList("MsgPlacardList", msg.Id);
@@ -417,7 +417,7 @@ namespace MySystem.Areas.Admin.Controllers
             }
             if (Id > 0)
             {
-                MsgPlacard edit = bsdb.MsgPlacard.FirstOrDefault(m => m.Id == Id);
+                MsgPlacard edit = db.MsgPlacard.FirstOrDefault(m => m.Id == Id);
                 if (edit != null)
                 {
                     RedisDbconn.Instance.Set("MsgPlacard:" + Id, edit);