Browse Source

Merge branch 'feature-dgy-服务费功能调整' into feature-dgy-后台测试

# Conflicts:
#	Areas/Admin/Controllers/MainServer/SysToolsController.cs
#	Startup.cs
DuGuYang 2 years ago
parent
commit
72ceae71ab

+ 2 - 1
.gitignore

@@ -1,3 +1,4 @@
 /bin
 /bin
 /publish
 /publish
-/obj
+/obj
+/appsettings.json

+ 20 - 0
.vscode/launch.json

@@ -23,6 +23,26 @@
                 "/Views": "${workspaceFolder}/Views"
                 "/Views": "${workspaceFolder}/Views"
             }
             }
         },
         },
+        {
+            "name": ".NET Core Launch (pro)",
+            "type": "coreclr",
+            "request": "launch",
+            "preLaunchTask": "build",
+            "program": "${workspaceFolder}/bin/Debug/netcoreapp3.0/MySystem.dll",
+            "args": [],
+            "cwd": "${workspaceFolder}",
+            "stopAtEntry": false,
+            "serverReadyAction": {
+                "action": "openExternally",
+                "pattern": "^\\s*Now listening on:\\s+(https?://\\S+)"
+            },
+            "env": {
+                "ASPNETCORE_ENVIRONMENT": "Production"
+            },
+            "sourceFileMap": {
+                "/Views": "${workspaceFolder}/Views"
+            }
+        },
         {
         {
             "name": ".NET Core Attach",
             "name": ".NET Core Attach",
             "type": "coreclr",
             "type": "coreclr",

+ 1 - 1
AppStart/ExcelHelper.cs

@@ -26,7 +26,7 @@ namespace MySystem
         {
         {
             while (true)
             while (true)
             {
             {
-                string data = RedisDbconn.Instance.RPop<string>("ExcelImportV2");
+                string data = RedisDbconn.Instance.RPop<string>("ExcelImport10");
                 if (!string.IsNullOrEmpty(data))
                 if (!string.IsNullOrEmpty(data))
                 {
                 {
                     string[] dataList = data.Split("#cut#");
                     string[] dataList = data.Split("#cut#");

+ 1 - 1
AppStart/OpExcelHelper.cs

@@ -26,7 +26,7 @@ namespace MySystem
         {
         {
             while (true)
             while (true)
             {
             {
-                string data = RedisDbconn.Instance.RPop<string>("ExcelImportV3");
+                string data = RedisDbconn.Instance.RPop<string>("ExcelImportOperate");
                 if (!string.IsNullOrEmpty(data))
                 if (!string.IsNullOrEmpty(data))
                 {
                 {
                     string[] dataList = data.Split("#cut#");
                     string[] dataList = data.Split("#cut#");

+ 3 - 4
AppStart/PublicFunction.cs

@@ -484,13 +484,12 @@ namespace MySystem
                         if (row.Cells.All(d => d.CellType == CellType.Blank)) continue;
                         if (row.Cells.All(d => d.CellType == CellType.Blank)) continue;
                         for (int j = row.FirstCellNum; j < cellCount; j++)
                         for (int j = row.FirstCellNum; j < cellCount; j++)
                         {
                         {
+                            string cellVal = "";
                             if (row.GetCell(j) != null)
                             if (row.GetCell(j) != null)
                             {
                             {
-                                if (!string.IsNullOrEmpty(row.GetCell(j).ToString()) && !string.IsNullOrWhiteSpace(row.GetCell(j).ToString()))
-                                {
-                                    rowList.Add(row.GetCell(j).ToString());
-                                }
+                                cellVal = row.GetCell(j).ToString();
                             }
                             }
+                            rowList.Add(cellVal);
                         }
                         }
                         if (rowList.Count > 0)
                         if (rowList.Count > 0)
                             dtTable.Rows.Add(rowList.ToArray());
                             dtTable.Rows.Add(rowList.ToArray());

+ 0 - 4
AppStart/Redis/RedisDbconn.cs

@@ -14,10 +14,6 @@ namespace MySystem
         public static CSRedis.CSRedisClient csredis;
         public static CSRedis.CSRedisClient csredis;
         private RedisDbconn()
         private RedisDbconn()
         {
         {
-            if (csredis == null)
-            {
-                csredis = new CSRedis.CSRedisClient(ConfigurationManager.AppSettings["RedisConnStr"].ToString());
-            }
         }
         }
 
 
         #region 设置单个字段
         #region 设置单个字段

+ 29 - 1
AppStart/TestHelper.cs

@@ -25,6 +25,11 @@ namespace MySystem
             Thread thread2 = new Thread(ImportPost2Do);
             Thread thread2 = new Thread(ImportPost2Do);
             thread2.IsBackground = true;
             thread2.IsBackground = true;
             thread2.Start();
             thread2.Start();
+
+            
+            Thread thread3 = new Thread(ImportPost3Do);
+            thread3.IsBackground = true;
+            thread3.Start();
         }
         }
 
 
         public void ImportPostDo()
         public void ImportPostDo()
@@ -65,6 +70,25 @@ namespace MySystem
                 }
                 }
             }
             }
         }
         }
+        public void ImportPost3Do()
+        {
+            while (true)
+            {
+                string data = RedisDbconn.Instance.RPop<string>("MakerCouponsQueue:3");
+                if (!string.IsNullOrEmpty(data))
+                {
+                    int count = int.Parse(function.CheckInt(data));
+                    if (count > 0)
+                    {
+                        MakerCoupons(3, count);
+                    }
+                }
+                else
+                {
+                    Thread.Sleep(10000);
+                }
+            }
+        }
 
 
         //生成券,Kind:1-电签券,2-大机券
         //生成券,Kind:1-电签券,2-大机券
         public void MakerCoupons(int Kind = 1, int count = 0)
         public void MakerCoupons(int Kind = 1, int count = 0)
@@ -72,7 +96,11 @@ namespace MySystem
             try
             try
             {
             {
                 WebCMSEntities db = new WebCMSEntities();
                 WebCMSEntities db = new WebCMSEntities();
-                string StartCode = db.PosCoupons.Where(m => m.QueryCount == Kind).OrderByDescending(m => m.Id).FirstOrDefault().ExchangeCode;
+                string StartCode = "0" + Kind + "00000000";
+                if(db.PosCoupons.Any(m => m.QueryCount == Kind))
+                {
+                    StartCode = db.PosCoupons.Where(m => m.QueryCount == Kind).OrderByDescending(m => m.Id).FirstOrDefault().ExchangeCode;
+                }
                 int QueryCount = Kind;
                 int QueryCount = Kind;
                 Kind += 1;
                 Kind += 1;
                 string title = "0" + Kind.ToString();
                 string title = "0" + Kind.ToString();

+ 1 - 1
Areas/Admin/Controllers/MainServer/PosMachinesTwoChangeController.cs

@@ -601,7 +601,7 @@ namespace MySystem.Areas.Admin.Controllers
         public string ImportPost(string ExcelPath)
         public string ImportPost(string ExcelPath)
         {
         {
             string key = function.MD5_16(Guid.NewGuid().ToString());
             string key = function.MD5_16(Guid.NewGuid().ToString());
-            RedisDbconn.Instance.AddList("ExcelImportV2", ExcelPath + "#cut#ChangeFee#cut#" + key + "#cut#" + SysUserName);
+            RedisDbconn.Instance.AddList("ExcelImport10", ExcelPath + "#cut#ChangeFee#cut#" + key + "#cut#" + SysUserName);
             return "success|" + key;
             return "success|" + key;
         }
         }
         public string CheckImport(string key)
         public string CheckImport(string key)

+ 1 - 1
Areas/Admin/Controllers/MainServer/PosMachinesTwoController.cs

@@ -515,7 +515,7 @@ namespace MySystem.Areas.Admin.Controllers
         public string ImportPost(string ExcelPath)
         public string ImportPost(string ExcelPath)
         {
         {
             string key = function.MD5_16(Guid.NewGuid().ToString());
             string key = function.MD5_16(Guid.NewGuid().ToString());
-            RedisDbconn.Instance.AddList("ExcelImportV2", ExcelPath + "#cut#ImportJKCreateData#cut#" + key + "#cut#" + SysUserName);
+            RedisDbconn.Instance.AddList("ExcelImport10", ExcelPath + "#cut#ImportJKCreateData#cut#" + key + "#cut#" + SysUserName);
             return "success|" + key;
             return "success|" + key;
         }
         }
         public string CheckImport(string key)
         public string CheckImport(string key)

+ 1 - 0
Areas/Admin/Controllers/MainServer/PosMerchantInfoListController.cs

@@ -696,6 +696,7 @@ namespace MySystem.Areas.Admin.Controllers
                 Ids += id + ",";
                 Ids += id + ",";
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("StandardStatus", 101);//设置为可退押状态
                 Fields.Add("StandardStatus", 101);//设置为可退押状态
+                Fields.Add("MatchTime", DateTime.Now);//设置入口开放时间
                 new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("PosMerchantInfo", Fields, id);
                 new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("PosMerchantInfo", Fields, id);
             }
             }
             string text = string.Format("商户押金退还批量通过,商户Id: '" + Ids.TrimEnd(',') + "',操作人: '" + SysUserName + "_" + SysRealName + "',Time'" + DateTime.Now + "'");
             string text = string.Format("商户押金退还批量通过,商户Id: '" + Ids.TrimEnd(',') + "',操作人: '" + SysUserName + "_" + SysRealName + "',Time'" + DateTime.Now + "'");

+ 1 - 1
Areas/Admin/Controllers/MainServer/StoreHouseController.cs

@@ -943,7 +943,7 @@ namespace MySystem.Areas.Admin.Controllers
         public string ImportPost(string ExcelPath, int Kind = 0)
         public string ImportPost(string ExcelPath, int Kind = 0)
         {
         {
             string key = function.MD5_16(Guid.NewGuid().ToString());
             string key = function.MD5_16(Guid.NewGuid().ToString());
-            RedisDbconn.Instance.AddList("ExcelImportV2", ExcelPath + "#cut#" + Kind + "#cut#" + key + "#cut#" + SysUserName);
+            RedisDbconn.Instance.AddList("ExcelImport10", ExcelPath + "#cut#" + Kind + "#cut#" + key + "#cut#" + SysUserName);
             return "success|" + key;
             return "success|" + key;
         }
         }
         public string CheckImport(string key)
         public string CheckImport(string key)

+ 42 - 10
Areas/Admin/Controllers/MainServer/SysToolsController.cs

@@ -5546,6 +5546,40 @@ namespace MySystem.Areas.Admin.Controllers
         #endregion
         #endregion
 
 
 
 
+        #region 码牌解密
+        public IActionResult QrCodeDescryption(string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+            return View();
+        }
+        [HttpPost]
+        public string QrCodeDescryptionDo(string SnNos)
+        {
+            string[] SnNo = SnNos.Replace("\r", "").Replace("\n", ",").Split(',');
+            string code = "";
+            string sn = "";
+            for (int a = 0; a < SnNo.Length; a++)
+            {
+                sn = SnNo[a];
+                if (sn.Length > 20)
+                {
+                    sn = System.Web.HttpUtility.UrlDecode(sn);
+                    if (!sn.EndsWith("="))
+                    {
+                        sn += "=";
+                    }
+                    sn = dbconn.Decrypt3DES(sn, "l2k0b2#3");
+                    sn = sn.TrimEnd('\0');
+                    sn = sn.Substring(0, 20);
+                }
+                code += sn + "<br />\n";
+            }
+            return "success" + "|" + code;
+        }
+        #endregion
+
         #region 查询指定创客下四级信息
         #region 查询指定创客下四级信息
 
 
         public IActionResult SeeUserLevel4Info(string right)
         public IActionResult SeeUserLevel4Info(string right)
@@ -5555,8 +5589,6 @@ namespace MySystem.Areas.Admin.Controllers
 
 
             return View();
             return View();
         }
         }
-
-        [HttpPost]
         public string SeeUserLevel4InfoDo(string MakerCode, string MakerCodes)
         public string SeeUserLevel4InfoDo(string MakerCode, string MakerCodes)
         {
         {
             var user = db.Users.FirstOrDefault(m => m.MakerCode == MakerCode) ?? new Users();
             var user = db.Users.FirstOrDefault(m => m.MakerCode == MakerCode) ?? new Users();
@@ -5779,7 +5811,7 @@ namespace MySystem.Areas.Admin.Controllers
                         else if (Deposit == "99") Deposit = "99";
                         else if (Deposit == "99") Deposit = "99";
                         else if (Deposit == "199") Deposit = "199";
                         else if (Deposit == "199") Deposit = "199";
                         else if (Deposit == "299") Deposit = "299";
                         else if (Deposit == "299") Deposit = "299";
-                        else 
+                        else
                         {
                         {
                             return "失败,无" + Deposit + "服务费相关设置权限";
                             return "失败,无" + Deposit + "服务费相关设置权限";
                         }
                         }
@@ -5796,7 +5828,7 @@ namespace MySystem.Areas.Admin.Controllers
                         else if (Deposit == "99") Deposit = "471";
                         else if (Deposit == "99") Deposit = "471";
                         else if (Deposit == "199") Deposit = "472";
                         else if (Deposit == "199") Deposit = "472";
                         else if (Deposit == "299") Deposit = "473";
                         else if (Deposit == "299") Deposit = "473";
-                        else 
+                        else
                         {
                         {
                             return "失败,无" + Deposit + "服务费相关设置权限";
                             return "失败,无" + Deposit + "服务费相关设置权限";
                         }
                         }
@@ -5812,7 +5844,7 @@ namespace MySystem.Areas.Admin.Controllers
                         if (Deposit == "99") Deposit = "100";
                         if (Deposit == "99") Deposit = "100";
                         else if (Deposit == "199") Deposit = "200";
                         else if (Deposit == "199") Deposit = "200";
                         else if (Deposit == "299") Deposit = "300";
                         else if (Deposit == "299") Deposit = "300";
-                        else 
+                        else
                         {
                         {
                             return "失败,无" + Deposit + "服务费相关设置权限";
                             return "失败,无" + Deposit + "服务费相关设置权限";
                         }
                         }
@@ -5829,7 +5861,7 @@ namespace MySystem.Areas.Admin.Controllers
                         else if (Deposit == "99") Deposit = "99";
                         else if (Deposit == "99") Deposit = "99";
                         else if (Deposit == "199") Deposit = "199";
                         else if (Deposit == "199") Deposit = "199";
                         else if (Deposit == "249") Deposit = "249";
                         else if (Deposit == "249") Deposit = "249";
-                        else 
+                        else
                         {
                         {
                             return "失败,无" + Deposit + "服务费相关设置权限";
                             return "失败,无" + Deposit + "服务费相关设置权限";
                         }
                         }
@@ -5846,7 +5878,7 @@ namespace MySystem.Areas.Admin.Controllers
                         else if (Deposit == "99") Deposit = "99";
                         else if (Deposit == "99") Deposit = "99";
                         else if (Deposit == "199") Deposit = "199";
                         else if (Deposit == "199") Deposit = "199";
                         else if (Deposit == "299") Deposit = "299";
                         else if (Deposit == "299") Deposit = "299";
-                        else 
+                        else
                         {
                         {
                             return "失败,无" + Deposit + "服务费相关设置权限";
                             return "失败,无" + Deposit + "服务费相关设置权限";
                         }
                         }
@@ -5862,7 +5894,7 @@ namespace MySystem.Areas.Admin.Controllers
                         if (Deposit == "99") Deposit = "100";
                         if (Deposit == "99") Deposit = "100";
                         else if (Deposit == "199") Deposit = "200";
                         else if (Deposit == "199") Deposit = "200";
                         else if (Deposit == "299") Deposit = "300";
                         else if (Deposit == "299") Deposit = "300";
-                        else 
+                        else
                         {
                         {
                             return "失败,无" + Deposit + "服务费相关设置权限";
                             return "失败,无" + Deposit + "服务费相关设置权限";
                         }
                         }
@@ -5879,7 +5911,7 @@ namespace MySystem.Areas.Admin.Controllers
                         else if (Deposit == "99") Deposit = "99";
                         else if (Deposit == "99") Deposit = "99";
                         else if (Deposit == "199") Deposit = "199";
                         else if (Deposit == "199") Deposit = "199";
                         else if (Deposit == "299") Deposit = "299";
                         else if (Deposit == "299") Deposit = "299";
-                        else 
+                        else
                         {
                         {
                             return "失败,无" + Deposit + "服务费相关设置权限";
                             return "失败,无" + Deposit + "服务费相关设置权限";
                         }
                         }
@@ -5896,7 +5928,7 @@ namespace MySystem.Areas.Admin.Controllers
                         else if (Deposit == "99") Deposit = "99";
                         else if (Deposit == "99") Deposit = "99";
                         else if (Deposit == "199") Deposit = "199";
                         else if (Deposit == "199") Deposit = "199";
                         else if (Deposit == "299") Deposit = "299";
                         else if (Deposit == "299") Deposit = "299";
-                        else 
+                        else
                         {
                         {
                             return "失败,无" + Deposit + "服务费相关设置权限";
                             return "失败,无" + Deposit + "服务费相关设置权限";
                         }
                         }

+ 89 - 11
Areas/Admin/Controllers/MainServer/TradeRecordController.cs

@@ -385,25 +385,103 @@ namespace MySystem.Areas.Admin.Controllers
         #endregion
         #endregion
 
 
         #region 导入数据
         #region 导入数据
+        public IActionResult Import(string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+            return View();
+        }
         /// <summary>
         /// <summary>
         /// 导入数据
         /// 导入数据
         /// </summary>
         /// </summary>
         /// <param name="ExcelData"></param>
         /// <param name="ExcelData"></param>
-        public string Import(string ExcelData)
+        public string ImportPost(string ExcelPath)
         {
         {
-            ExcelData = HttpUtility.UrlDecode(ExcelData);
-            JsonData list = JsonMapper.ToObject(ExcelData);
-            for (int i = 1; i < list.Count; i++)
+            string FullExcelPath = function.getPath(ExcelPath);
+            FullExcelPath = FullExcelPath.Replace("//", "/");
+            DataTable list = new PublicFunction().ExcelToDataTable(FullExcelPath);
+            foreach (DataRow dr in list.Rows)
             {
             {
-                JsonData dr = list[i];
-
-                db.TradeRecord.Add(new TradeRecord()
+                string OrderNo = dr["订单编码"].ToString();
+                string CreateDate = dr["订单创建时间"].ToString();
+                string PhoneNumber = dr["选择号码"].ToString();
+                string HasFirstCharge = dr["是否有首充"].ToString();
+                string FirstChargeAmount = dr["首充金额(元)"].ToString();
+                string Province = dr["号码归属省份"].ToString();
+                string City = dr["号码归属地市"].ToString();
+                string ProductName = dr["商品名称"].ToString();
+                string ActiveName = dr["促销活动名称"].ToString();
+                string ProductType = dr["商品类型名称"].ToString();
+                string ActualAmount = dr["实付金额(元)"].ToString();
+                string OrderStatus = dr["订单状态"].ToString();
+                string ActStatus = dr["激活状态名称"].ToString();
+                string ActDate = dr["激活时间"].ToString();
+                string WorkNo = dr["BOSS员工工号"].ToString();
+                string AccountName = dr["账号姓名"].ToString();
+                string SimNo = dr["SIM卡号"].ToString();
+
+                bool checkMer = db.PosMerchantInfo.Any(m => m.KqMerNo == PhoneNumber);
+                if (!checkMer)
                 {
                 {
-                    CreateDate = DateTime.Now,
-                    UpdateDate = DateTime.Now,
+                    spdb.BindRecord.Add(new SpModels.BindRecord()
+                    {
+                        CreateDate = DateTime.Parse(CreateDate),
+                        UpdateTime = DateTime.Parse(CreateDate), //机具绑定、解绑时间
+                        CreateTime = DateTime.Parse(CreateDate), //商户操作时间
+                        MerNewSnNo = PhoneNumber, //商户手机号
+                        MerSnNo = SimNo, //序列号
+                        MerName = AccountName, //商户名称
+                        MerNo = PhoneNumber, //商户编号
+                        Remark = ProductType,
+                        Field1 = Province,
+                        Field2 = ActiveName,
+                        Field3 = ProductName,
+                        Field4 = WorkNo,
+                        Field5 = ActStatus,
+                        SeoTitle = ActualAmount,
+                        SeoKeyword = ActDate,
+                        ProductType = "14",
+                        Status = 1,
+                    });
+
+                    spdb.Merchants.Add(new SpModels.Merchants()
+                    {
+                        SnNo = SimNo,
+                        CreateTime = DateTime.Parse(CreateDate),
+                        UpdateTime = DateTime.Parse(CreateDate),
+                        AgentName = AccountName,
+                        MerRealName = AccountName,
+                        MerMobile = PhoneNumber,
+                        MerNo = PhoneNumber,
+                        MerName = AccountName,
+                        ProductType = "14",
+                        Status = 1,
+                    });
+                }
 
 
-                });
-                db.SaveChanges();
+                // spdb.TradeRecord.Add(new SpModels.TradeRecord()
+                // {
+                //     CreateDate = DateTime.Parse(CreateDate), //创建时间
+                //     UpdateDate = DateTime.Parse(ActDate), //激活时间
+                //     BankCardNo = PhoneNumber, //卡号(掩码)
+                //     TradeSerialNo = OrderNo, //订单编号
+                //     TradeAmount = decimal.Parse(ActualAmount), //交易金额
+                //     TradeSnNo = SimNo, //序列号
+                //     AgentNo = PhoneNumber, //一级服务商编号
+                //     MerNo = PhoneNumber, //商户编
+                //     TradeStatus = OrderStatus, //订单状态
+                //     ChannelSerial = OrderNo, //请求号
+                //     Field1 = OrderSource,
+                //     Field2 = HasFirstCharge,
+                //     Field3 = FirstChargeAmount,
+                //     Field4 = ProductType,
+                //     Field5 = ActiveName,
+                //     SerEntryMode = ActStatus,
+                //     ProductType = "14",
+                //     Status = 1,
+                // });
+
+                spdb.SaveChanges();
             }
             }
             AddSysLog("0", "TradeRecord", "Import");
             AddSysLog("0", "TradeRecord", "Import");
             return "success";
             return "success";

+ 1 - 1
Areas/Admin/Controllers/MainServer/UserCashRecordController.cs

@@ -475,7 +475,7 @@ namespace MySystem.Areas.Admin.Controllers
         public string ImportPost(string ExcelPath)
         public string ImportPost(string ExcelPath)
         {
         {
             string key = function.MD5_16(Guid.NewGuid().ToString());
             string key = function.MD5_16(Guid.NewGuid().ToString());
-            RedisDbconn.Instance.AddList("ExcelImportV2", ExcelPath + "#cut#UserCashRecord#cut#" + key + "#cut#" + SysUserName);
+            RedisDbconn.Instance.AddList("ExcelImport10", ExcelPath + "#cut#UserCashRecord#cut#" + key + "#cut#" + SysUserName);
             return "success|" + key;
             return "success|" + key;
         }
         }
         public string CheckImport(string key)
         public string CheckImport(string key)

+ 1 - 1
Areas/Admin/Controllers/OperateServer/StoreHouseOperateController.cs

@@ -520,7 +520,7 @@ namespace MySystem.Areas.Admin.Controllers
         public string ImportPost(string ExcelPath, int Kind = 0)
         public string ImportPost(string ExcelPath, int Kind = 0)
         {
         {
             string key = function.MD5_16(Guid.NewGuid().ToString());
             string key = function.MD5_16(Guid.NewGuid().ToString());
-            RedisDbconn.Instance.AddList("ExcelImportV2", ExcelPath + "#cut#" + Kind + "#cut#" + key + "#cut#" + SysUserName);
+            RedisDbconn.Instance.AddList("ExcelImport10", ExcelPath + "#cut#" + Kind + "#cut#" + key + "#cut#" + SysUserName);
             return "success|" + key;
             return "success|" + key;
         }
         }
         public string CheckImport(string key)
         public string CheckImport(string key)

+ 1 - 1
Areas/Admin/Controllers/OperateServer/UserCashRecordOperateController.cs

@@ -386,7 +386,7 @@ namespace MySystem.Areas.Admin.Controllers
         public string ImportPost(string ExcelPath)
         public string ImportPost(string ExcelPath)
         {
         {
             string key = function.MD5_16(Guid.NewGuid().ToString());
             string key = function.MD5_16(Guid.NewGuid().ToString());
-            RedisDbconn.Instance.AddList("ExcelImportV3", ExcelPath + "#cut#OpUserCashRecord#cut#" + key + "#cut#" + SysUserName);
+            RedisDbconn.Instance.AddList("ExcelImportOperate", ExcelPath + "#cut#OpUserCashRecord#cut#" + key + "#cut#" + SysUserName);
             return "success|" + key;
             return "success|" + key;
         }
         }
         public string CheckImport(string key)
         public string CheckImport(string key)

+ 1 - 1
Areas/Admin/Controllers/OperateServer/UserCashRecordOperatesController.cs

@@ -444,7 +444,7 @@ namespace MySystem.Areas.Admin.Controllers
         public string ImportPost(string ExcelPath)
         public string ImportPost(string ExcelPath)
         {
         {
             string key = function.MD5_16(Guid.NewGuid().ToString());
             string key = function.MD5_16(Guid.NewGuid().ToString());
-            RedisDbconn.Instance.AddList("ExcelImportV3", ExcelPath + "#cut#OpUserCashRecord#cut#" + key + "#cut#" + SysUserName);
+            RedisDbconn.Instance.AddList("ExcelImportOperate", ExcelPath + "#cut#OpUserCashRecord#cut#" + key + "#cut#" + SysUserName);
             return "success|" + key;
             return "success|" + key;
         }
         }
         public string CheckImport(string key)
         public string CheckImport(string key)

+ 30 - 3
Areas/Admin/Views/MainServer/SysTools/QrCodeEncryption.cshtml

@@ -8,7 +8,7 @@
 
 
 <head>
 <head>
     <meta charset="utf-8">
     <meta charset="utf-8">
-    <title>码牌加密</title>
+    <title>码牌加/解密</title>
     <meta name="renderer" content="webkit">
     <meta name="renderer" content="webkit">
     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
     <meta name="viewport"
     <meta name="viewport"
@@ -43,7 +43,8 @@
                     </div>
                     </div>
                     <div class="layui-form-item ml10">
                     <div class="layui-form-item ml10">
                         <div class="layui-input-block">
                         <div class="layui-input-block">
-                            <button type="button" class="layui-btn" onclick="save()">提交</button>
+                            <button type="button" class="layui-btn" onclick="Encryption()">加密</button>
+                            <button type="button" class="layui-btn" onclick="Descryption()">解密</button>
                         </div>
                         </div>
                     </div>
                     </div>
                 </div>
                 </div>
@@ -56,7 +57,7 @@
     <script src="/other/mybjq/kindeditor-min.js"></script>
     <script src="/other/mybjq/kindeditor-min.js"></script>
     <script src="/other/mybjq/lang/zh_CN.js"></script>
     <script src="/other/mybjq/lang/zh_CN.js"></script>
     <script>
     <script>
-        function save() {
+        function Encryption() {
             var index = layer.load(1, {
             var index = layer.load(1, {
                 shade: [0.5, '#000']
                 shade: [0.5, '#000']
             });
             });
@@ -82,6 +83,32 @@
             });
             });
         }
         }
 
 
+        function Descryption() {
+            var index = layer.load(1, {
+                shade: [0.5, '#000']
+            });
+            var userdata = $("#confirmFrm").serialize();
+            $.ajax({
+                type: "POST",
+                url: "/Admin/SysTools/QrCodeDescryptionDo?r=" + Math.random(1),
+                data: userdata,
+                dataType: "text",
+                success: function (data) {
+                    layer.close(index); //关闭弹层
+                    if (data.indexOf("success") == 0) {
+                        layer.msg("解密成功");
+                        var datalist = data.split('|');
+                        layer.alert(datalist[1], {area:['700px','750px']});
+                        @* layer.alert(datalist[1], function () {
+                            window.location.reload();
+                        }); *@
+                    } else {
+                        layer.msg("解密失败");
+                    }
+                }
+            });
+        }
+
 
 
         //编辑器
         //编辑器
         KindEditor.ready(function (K) {
         KindEditor.ready(function (K) {

+ 129 - 0
Areas/Admin/Views/MainServer/TradeRecord/Import.cshtml

@@ -0,0 +1,129 @@
+@{
+    string RightInfo = ViewBag.RightInfo as string;
+    string right = ViewBag.right as string;
+    string ExcelKind = ViewBag.ExcelKind as string;
+    
+}
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8">
+    <title>导入数据</title>
+    <meta name="renderer" content="webkit">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
+    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
+    <script src="/admin/js/jquery-1.10.1.min.js"></script>
+    <script src="/admin/js/LAreaData2.js"></script>
+    <style>
+        .layui-form-label{
+            width: 135px !important;
+        }
+        .layui-form-item .layui-input-block{
+            margin-left: 165px !important;
+        }
+    </style>
+</head>
+<body>
+
+    <div class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin">
+        <input type="hidden" name="Kind" value="@ExcelKind" />
+        
+        <div class="layui-card">
+          <div class="layui-card-body">
+            <div class="layui-tab" lay-filter="mytabbar">
+                <div class="layui-tab-content mt20">
+                    <div class="layui-tab-item layui-show">
+                        <div class="layui-form-item">
+                            <label class="layui-form-label">模板下载</label>
+                            <div class="layui-form-mid layui-word-aux" id="excelTemp">
+                                <a href="https://kexiaoshuang.oss-cn-chengdu.aliyuncs.com/ExcelTmplate/%E5%B9%BF%E7%94%B5%E5%8D%A1%E6%BF%80%E6%B4%BB%E8%A1%A8%E6%A0%BC%E6%A8%A1%E6%9D%BF.xlsx">点击下载入库模版</a>
+                            </div>
+                        </div>
+                        <div class="layui-form-item">
+                            <label class="layui-form-label">excel文件</label>
+                            <div class="layui-input-block">
+                                <div class="layui-upload">
+                                    <input type="hidden" id="ExcelPath" name="ExcelPath" value="">
+                                    <button class="layui-btn" type="button" id="ExcelPathBtn">选择</button>
+                                    <div class="layui-inline layui-word-aux"></div>
+                                </div>
+                                <div class="mt10" id="ExcelPathFile">
+                                </div>
+                            </div>
+                        </div>
+                        
+                    </div>
+
+                </div>
+            </div>
+            <div class="layui-form-item layui-hide">
+                <input type="button" lay-submit lay-filter="LAY-list-front-submit" id="LAY-list-front-submit" value="确认">
+            </div>
+          </div>
+        </div>
+    </div>
+
+    <script src="/layuiadmin/layui/layui.js"></script>
+    <script src="/other/oss/upload-min.js?r=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>
+    <script src="/other/mybjq/kindeditor-min.js"></script>
+    <script src="/other/mybjq/lang/zh_CN.js"></script>
+    <script>
+        
+                    
+        //编辑器
+        KindEditor.ready(function (K) {
+            
+        });
+
+        
+        var tree;
+        var element;
+        var upload;
+        layui.config({
+            base: '/layuiadmin/' //静态资源所在路径
+        }).extend({
+            index: 'lib/index' //主入口模块
+        }).use(['index', 'form', 'upload', 'layedit', 'laydate', 'element', 'croppers', 'transfer', 'tree', 'util'], function () {
+            var $ = layui.$
+                , form = layui.form
+                , layer = layui.layer
+                , layedit = layui.layedit
+                , laydate = layui.laydate
+                , croppers = layui.croppers
+                , transfer = layui.transfer
+                , util = layui.util;
+            tree = layui.tree;
+            element = layui.element;
+            upload = layui.upload;
+        
+            //Hash地址的定位
+            var layid = location.hash.replace(/^#test=/, '');
+            element.tabChange('test', layid);
+            element.on('tab(test)', function (elem) {
+                location.hash = 'test=' + $(this).attr('lay-id');
+            });
+    
+            //日期
+            
+
+            //上传文件
+            WebUploadJs('ExcelPathBtn', '@(Library.ConfigurationManager.AppSettings["Database"].ToString())/upload/v2', {width:0,height:0,quality:0},{max_file_size:1048576},  function (filename) {
+                $('#ExcelPathFile').html(filename);
+                $('#ExcelPath').val(filename);
+            });
+
+            //穿梭框
+            
+            
+
+            //TreeView,比如权限管理
+            
+
+            //省市区
+
+        });
+
+    </script>
+</body>
+</html>

+ 33 - 0
Areas/Admin/Views/MainServer/TradeRecord/Index.cshtml

@@ -140,6 +140,15 @@
                         </button>
                         </button>
                         @if (RightInfo.Contains("," + right + "_export,"))
                         @if (RightInfo.Contains("," + right + "_export,"))
                         {
                         {
+                            if(BrandId == "14")
+                            {
+                            <button class="layui-btn" data-type="Import">
+                                <i class="layui-icon layui-icon-upload layuiadmin-button-btn"></i>导激活
+                            </button>
+                            <button class="layui-btn" data-type="ImportTrade">
+                                <i class="layui-icon layui-icon-upload layuiadmin-button-btn"></i>导交易
+                            </button>
+                            }
                             <button class="layui-btn" data-type="ExportExcel">
                             <button class="layui-btn" data-type="ExportExcel">
                                 <i class="layui-icon layui-icon-export layuiadmin-button-btn"></i>导出
                                 <i class="layui-icon layui-icon-export layuiadmin-button-btn"></i>导出
                             </button>
                             </button>
@@ -159,6 +168,30 @@
             </div>
             </div>
         </div>
         </div>
     </div>
     </div>
+    <div id="excelForm" style="display:none; padding:20px;">
+        <div class="layui-tab-item layui-show">
+            <div class="layui-form-item">
+                <label class="layui-form-label">模板下载</label>
+                <div class="layui-form-mid layui-word-aux" id="excelTemp">
+                </div>
+            </div>
+            <div class="layui-form-item">
+                <label class="layui-form-label">excel文件</label>
+                <div class="layui-form-mid layui-word-aux">
+                    <div class="layui-upload">
+                        <input type="file" id="ExcelFile" name="ExcelFile" value="">
+                    </div>
+                    <div class="mt10" id="ExcelFileList">
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="layui-form-item ml10">
+            <div class="layui-input-block">
+                <button type="button" class="layui-btn" onclick="ConfirmImport()">立即导入</button>
+            </div>
+        </div>
+    </div>
 
 
     <script src="/layuiadmin/layui/layui.js"></script>
     <script src="/layuiadmin/layui/layui.js"></script>
     <script src="/layuiadmin/modules_main/TradeRecord_Admin.js?r=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>
     <script src="/layuiadmin/modules_main/TradeRecord_Admin.js?r=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>

+ 34 - 16
Startup.cs

@@ -90,11 +90,6 @@ namespace MySystem
                 };
                 };
             });
             });
             MySystemLib.SystemPublicFuction.appcheck = "success";
             MySystemLib.SystemPublicFuction.appcheck = "success";
-            initMainServer();
-            initBsServer();
-            initCashServer();
-            initSpServer();
-            initOperateServer();
 
 
             RedisDbconn.csredis = new CSRedis.CSRedisClient(Configuration["Setting:RedisConnStr"]);
             RedisDbconn.csredis = new CSRedis.CSRedisClient(Configuration["Setting:RedisConnStr"]);
             // TendisDbconn.csredis = new CSRedis.CSRedisClient(Configuration["Setting:TendisConnStr"]);
             // TendisDbconn.csredis = new CSRedis.CSRedisClient(Configuration["Setting:TendisConnStr"]);
@@ -103,12 +98,15 @@ namespace MySystem
         // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
         // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
         public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
         public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
         {
         {
+            string Env = "Develop";
             if (env.IsDevelopment())
             if (env.IsDevelopment())
             {
             {
+                Env = "Develop";
                 app.UseDeveloperExceptionPage();
                 app.UseDeveloperExceptionPage();
             }
             }
-            else
+            else 
             {
             {
+                Env = "Production";
                 app.UseHsts();
                 app.UseHsts();
             }
             }
             Library.function.WritePage("/", "WebRootPath.txt", env.WebRootPath);
             Library.function.WritePage("/", "WebRootPath.txt", env.WebRootPath);
@@ -134,13 +132,28 @@ namespace MySystem
                     name: "default",
                     name: "default",
                     pattern: "{controller=Home}/{action=Index}/{Id?}");
                     pattern: "{controller=Home}/{action=Index}/{Id?}");
             });
             });
-            ResetUserTradeService.Instance.Start();
-            ResetMerchantTradeService.Instance.Start();
-            SycnProfitServiceV3.Instance.Start();
-            SycnHelpProfitService.Instance.Start();
-            ExcelHelper.Instance.Start();
-            OpExcelHelper.Instance.Start();
-            SycnUserMachineCountHelper.Instance.Start(); //重置创客机具数量
+            
+            initMainServer(Env);
+            initBsServer();
+            initCashServer();
+            initSpServer();
+            initOperateServer();
+
+            if(Env == "Develop")
+            {
+            }
+            if(Env == "Production")
+            {
+                ResetUserTradeService.Instance.Start();
+                ResetMerchantTradeService.Instance.Start();
+                SycnProfitServiceV3.Instance.Start();
+                SycnHelpProfitService.Instance.Start();
+                ExcelHelper.Instance.Start();
+                OpExcelHelper.Instance.Start();
+                SycnUserMachineCountHelper.Instance.Start(); //重置创客机具数量
+
+                TestHelper.Instance.Start(); //生成兑换券
+            }
         }
         }
 
 
 
 
@@ -151,15 +164,20 @@ namespace MySystem
 
 
 
 
         //初始化数据结构
         //初始化数据结构
-        private void initMainServer()
+        private void initMainServer(string Env)
         {
         {
+            string dbName = "KxsMainServer";
+            if(Env == "Production")
+            {
+                dbName = "KxsProfitServer";
+            }
             Dictionary<string, Dictionary<string, string>> tables = new Dictionary<string, Dictionary<string, string>>();
             Dictionary<string, Dictionary<string, string>> tables = new Dictionary<string, Dictionary<string, string>>();
             Library.OtherMySqlConn.connstr = Configuration["Setting:SqlConnStr"];
             Library.OtherMySqlConn.connstr = Configuration["Setting:SqlConnStr"];
-            System.Data.DataTable tablecollection = Library.OtherMySqlConn.dtable("select DISTINCT TABLE_NAME from information_schema.columns where table_schema = 'KxsMainServer'");
+            System.Data.DataTable tablecollection = Library.OtherMySqlConn.dtable("select DISTINCT TABLE_NAME from information_schema.columns where table_schema = '" + dbName + "'");
             foreach (System.Data.DataRow subtable in tablecollection.Rows)
             foreach (System.Data.DataRow subtable in tablecollection.Rows)
             {
             {
                 Dictionary<string, string> Columns = new Dictionary<string, string>();
                 Dictionary<string, string> Columns = new Dictionary<string, string>();
-                System.Data.DataTable columncollection = Library.OtherMySqlConn.dtable("select COLUMN_NAME,DATA_TYPE from information_schema.columns where table_schema = 'KxsMainServer' and TABLE_NAME='" + subtable["TABLE_NAME"].ToString() + "'");
+                System.Data.DataTable columncollection = Library.OtherMySqlConn.dtable("select COLUMN_NAME,DATA_TYPE from information_schema.columns where table_schema = '" + dbName + "' and TABLE_NAME='" + subtable["TABLE_NAME"].ToString() + "'");
                 foreach (System.Data.DataRow column in columncollection.Rows)
                 foreach (System.Data.DataRow column in columncollection.Rows)
                 {
                 {
                     string datatype = column["DATA_TYPE"].ToString();
                     string datatype = column["DATA_TYPE"].ToString();

+ 8 - 13
appsettings.json

@@ -8,23 +8,18 @@
   },
   },
   "AllowedHosts": "*",
   "AllowedHosts": "*",
   "Setting": {
   "Setting": {
-    "AppKey": "",
-    "AppId": "",
-    "CheckUrl": "",
     "ConnectionStrings": "",
     "ConnectionStrings": "",
-    "WebServiceUrl": "",
-    "DbSchemeUrl": "",
     "OpHost": "http://operateadmin.kexiaoshuang.com/",
     "OpHost": "http://operateadmin.kexiaoshuang.com/",
-    "Host": "http://test.bs.kexiaoshuang.com/",
+    "Host": "http://admin.kexiaoshuang.com/",
     "OssHost": "http://oss.kexiaoshuang.com",
     "OssHost": "http://oss.kexiaoshuang.com",
     "Database": "KxsMainServer",
     "Database": "KxsMainServer",
-    "SqlConnStr": "server=47.109.31.237;port=3306;user=KxsMainServer;password=FrW8ZfxlcaVdm1r0;database=KxsMainServer;charset=utf8;",
-    "StatSqlConnStr": "server=47.109.31.237;port=3306;user=KxsMainServer;password=FrW8ZfxlcaVdm1r0;database=KxsMainServer;charset=utf8;ConnectionTimeout=600;DefaultCommandTimeout=600;",
-    "OpSqlConnStr": "server=47.109.31.237;port=3306;user=KxsOpServer;password=r7jwZ8ydLoeswDR4;database=KxsOpServer;charset=utf8;",
-    "BsSqlConnStr": "server=47.109.31.237;port=3306;user=KxsBsServer;password=wyA1bEhi6aAkN8SB;database=KxsBsServer;charset=utf8;",
-    "SpSqlConnStr": "server=47.109.31.237;port=3306;user=KxsSpServer;password=jJ9qKsvwWgQA9xWG;database=KxsSpServer;charset=utf8;",
-    "CashSqlConnStr": "server=47.109.31.237;port=3306;user=KxsCashServer;password=LNGvM18W6SaIGKBC;database=KxsCashServer;charset=utf8;",
-    "RedisConnStr": "47.109.31.237:6379,password=klm@redis,DefaultDatabase=1,poolsize=500,preheat=50,asyncPipeline=true",
+    "SqlConnStr": "server=rm-2vcs4j67tla603c9d5o.mysql.cn-chengdu.rds.aliyuncs.com;port=3306;user=KxsProfitServer;password=FrW8ZfxlcaVdm1r0;database=KxsProfitServer;charset=utf8;Max Pool Size=512",
+    "StatSqlConnStr": "server=rm-2vcs4j67tla603c9d5o.mysql.cn-chengdu.rds.aliyuncs.com;port=3306;user=KxsProfitServer;password=FrW8ZfxlcaVdm1r0;database=KxsProfitServer;charset=utf8;ConnectionTimeout=600;DefaultCommandTimeout=600;",
+    "OpSqlConnStr": "server=rm-2vcs4j67tla603c9d5o.mysql.cn-chengdu.rds.aliyuncs.com;port=3306;user=KxsProfitServer;password=FrW8ZfxlcaVdm1r0;database=KxsOpServer;charset=utf8;",
+    "BsSqlConnStr": "server=rm-2vcs4j67tla603c9d5o.mysql.cn-chengdu.rds.aliyuncs.com;port=3306;user=KxsProfitServer;password=FrW8ZfxlcaVdm1r0;database=KxsBsServer;charset=utf8;",
+    "SpSqlConnStr": "server=47.108.229.115;port=3306;user=KxsSpServer;password=jJ9qKsvwWgQA9xWG;database=KxsSpServer;charset=utf8;",
+    "CashSqlConnStr": "server=47.108.229.115;port=3306;user=KxsCashServer;password=LNGvM18W6SaIGKBC;database=KxsCashServer;charset=utf8;",
+    "RedisConnStr": "47.108.207.184:6379,password=skb@redis2022,DefaultDatabase=0,poolsize=500,preheat=50,asyncPipeline=true",
     "IOSAppVersion": "1.0.0",
     "IOSAppVersion": "1.0.0",
     "AndroidAppVersion": "1.0.0",
     "AndroidAppVersion": "1.0.0",
     "OSSKey": "",
     "OSSKey": "",

+ 91 - 8
wwwroot/layuiadmin/modules_main/TradeRecord_Admin.js

@@ -353,14 +353,97 @@ layui.config({
             });
             });
             layer.full(perContent);
             layer.full(perContent);
         }
         }
-        , ImportData: function () {
-            layer.open({
-                type: 1,
-                title: '导入',
-                maxmin: false,
-                area: ['460px', '180px'],
-                content: $('#excelForm'),
-                cancel: function () {
+        , Import: function () {
+            var perContent = layer.open({
+                type: 2,
+                title: '导激活',
+                content: 'Import',
+                maxmin: true,
+                area: ['650px', '350px'],
+                btn: ['确定', '取消'],
+                yes: function (index, layero) {
+                    var iframeWindow = window['layui-layer-iframe' + index],
+                        submitID = 'LAY-list-front-submit',
+                        submit = layero.find('iframe').contents().find('#' + submitID);
+
+
+                    //监听提交
+                    iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
+                        var field = data.field; //获取提交的字段
+                        var userdata = "";
+                        for (var prop in field) {
+                            userdata += prop + "=" + encodeURIComponent(field[prop]) + "&";
+                        }
+                        //提交 Ajax 成功后,静态更新表格中的数据
+                        //$.ajax({});
+                        var loadindex = layer.load(1, {
+                            shade: [0.5, '#000']
+                        });
+                        $.ajax({
+                            type: "POST",
+                            url: "/Admin/TradeRecord/ImportPost?r=" + Math.random(1),
+                            data: userdata,
+                            dataType: "text",
+                            success: function (data) {
+                                layer.close(loadindex);
+                                if (data == 'success') {
+                                    layer.msg('导入成功', {time:2000}, function(){
+                                        window.location.reload();
+                                    });
+                                } else {
+                                    layer.msg(data);
+                                }
+                            }
+                        });
+                    });
+
+                    submit.trigger('click');
+                }
+            });
+        }        
+        , ImportTrade: function () {
+            var perContent = layer.open({
+                type: 2,
+                title: '导交易',
+                content: 'ImportTrade',
+                maxmin: true,
+                area: ['650px', '350px'],
+                btn: ['确定', '取消'],
+                yes: function (index, layero) {
+                    var iframeWindow = window['layui-layer-iframe' + index],
+                        submitID = 'LAY-list-front-submit',
+                        submit = layero.find('iframe').contents().find('#' + submitID);
+
+
+                    //监听提交
+                    iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
+                        var field = data.field; //获取提交的字段
+                        var userdata = "";
+                        for (var prop in field) {
+                            userdata += prop + "=" + encodeURIComponent(field[prop]) + "&";
+                        }
+                        //提交 Ajax 成功后,静态更新表格中的数据
+                        //$.ajax({});
+                        var loadindex = layer.load(1, {
+                            shade: [0.5, '#000']
+                        });
+                        $.ajax({
+                            type: "POST",
+                            url: "/Admin/TradeRecord/ImportTradePost?r=" + Math.random(1),
+                            data: userdata,
+                            dataType: "text",
+                            success: function (data) {
+                                layer.close(loadindex);
+                                if (data == 'success') {
+                                    layer.msg('导入成功');
+                                } else {
+                                    layer.msg(data);
+                                }
+                            }
+                        });
+                    });
+
+                    submit.trigger('click');
                 }
                 }
             });
             });
         }
         }