DuGuYang 3 лет назад
Родитель
Сommit
f30ea64e20
30 измененных файлов с 610 добавлено и 342 удалено
  1. 6 6
      AppStart/ExcelHelper.cs
  2. 1 1
      AppStart/Helper/SycnHelpProfitService.cs
  3. 282 132
      AppStart/Helper/SycnProfitServiceV2.cs
  4. 2 2
      AppStart/OssHelper.cs
  5. 0 90
      AppStart/SetDesposit.cs
  6. 13 0
      AppStart/Tables/ProgressUserList.cs
  7. 1 0
      Areas/Admin/Controllers/BsServer/BaseController.cs
  8. 48 48
      Areas/Admin/Controllers/HomeController.cs
  9. 28 0
      Areas/Admin/Controllers/MainServer/ExportTableController.cs
  10. 1 1
      Areas/Admin/Controllers/MainServer/HelpProfitRewardController.cs
  11. 8 8
      Areas/Admin/Controllers/MainServer/PosMachinesTwoChangeController.cs
  12. 1 1
      Areas/Admin/Controllers/MainServer/ProfitRewardRecordController.cs
  13. 43 36
      Areas/Admin/Controllers/MainServer/SysToolsController.cs
  14. 15 0
      Areas/Admin/Views/Home/Index.cshtml
  15. 2 2
      Areas/Admin/Views/Home/Login.cshtml
  16. 17 0
      Areas/Admin/Views/MainServer/ExportTable/Double.cshtml
  17. 17 0
      Areas/Admin/Views/MainServer/ExportTable/HelpProfit.cshtml
  18. 17 0
      Areas/Admin/Views/MainServer/ExportTable/OpenMachine.cshtml
  19. 17 0
      Areas/Admin/Views/MainServer/ExportTable/Profit.cshtml
  20. 17 0
      Areas/Admin/Views/MainServer/ExportTable/Recommend.cshtml
  21. 17 0
      Areas/Admin/Views/MainServer/ExportTable/StoreHouse.cshtml
  22. 17 0
      Areas/Admin/Views/MainServer/ExportTable/Subsidy.cshtml
  23. 17 0
      Areas/Admin/Views/MainServer/ExportTable/Trade.cshtml
  24. 7 0
      Controllers/HomeController.cs
  25. 3 3
      Models/BackEndOpRecord.cs
  26. 3 3
      Models/LeaderAccountRecord.cs
  27. 2 2
      Startup.cs
  28. 6 5
      wwwroot/layuiadmin/modules_main/PosMachinesTwoChange_Admin.js
  29. 0 0
      wwwroot/other/oss/upload-min-oss.js
  30. 2 2
      wwwroot/other/oss/upload-min-oss.jsold

+ 6 - 6
AppStart/ExcelHelper.cs

@@ -230,7 +230,7 @@ namespace MySystem
                                     Time = DateTime.Now,
                                     ErrorContent = ex.ToString(),
                                 };
-                                function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(msg), "BsServerAdminError");
+                                function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(msg), "导入Excel文件异常");
                             }
                             tran.Dispose();
                         }
@@ -527,7 +527,7 @@ namespace MySystem
                                         Time = DateTime.Now,
                                         ErrorContent = ex.ToString(),
                                     };
-                                    function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(msg), "BsServerAdminError");
+                                    function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(msg), "导入Excel文件异常");
                                 }
                             }
                         }
@@ -802,7 +802,7 @@ namespace MySystem
                                         Time = DateTime.Now,
                                         ErrorContent = ex.ToString(),
                                     };
-                                    function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(msg), "BsServerAdminError");
+                                    function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(msg), "导入Excel文件异常");
                                 }
                             }
                         }
@@ -1008,7 +1008,7 @@ namespace MySystem
                                         Time = DateTime.Now,
                                         ErrorContent = ex.ToString(),
                                     };
-                                    function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(msg), "BsServerAdminError");
+                                    function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(msg), "导入Excel文件异常");
                                 }
                             }
                         }
@@ -1298,7 +1298,7 @@ namespace MySystem
                                         Time = DateTime.Now,
                                         ErrorContent = ex.ToString(),
                                     };
-                                    function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(msg), "BsServerAdminError");
+                                    function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(msg), "导入Excel文件异常");
                                 }
                             }
                         }
@@ -1406,7 +1406,7 @@ namespace MySystem
                                         Time = DateTime.Now,
                                         ErrorContent = ex.ToString(),
                                     };
-                                    function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(msg), "BsServerAdminError");
+                                    function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(msg), "导入Excel文件异常");
                                 }
                             }
                         }

+ 1 - 1
AppStart/Helper/SycnHelpProfitService.cs

@@ -25,7 +25,7 @@ namespace MySystem
         {
             while (true)
             {
-                string content = RedisDbconn.Instance.RPop<string>("SycnHelpProfitQueue");
+                string content = RedisDbconn.Instance.RPop<string>("SycnHelpProfitQueue2");
                 if (!string.IsNullOrEmpty(content))
                 {
                     try

+ 282 - 132
AppStart/Helper/SycnProfitServiceV2.cs

@@ -25,7 +25,7 @@ namespace MySystem
         {
             while (true)
             {
-                string content = RedisDbconn.Instance.RPop<string>("SycnProfitQueue2");
+                string content = RedisDbconn.Instance.RPop<string>("SycnProfitQueue3");
                 if (!string.IsNullOrEmpty(content))
                 {
                     try
@@ -64,8 +64,13 @@ namespace MySystem
         {
             WebCMSEntities db = new WebCMSEntities();
             OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-            OtherMySqlConn.op("insert into ProfitRecord (CreateDate,CreateMan,SeoTitle,ParentNav,BrandId,UserId,DirectFlag,ProfitAmount) select now(),'root','" + date + "',(select ParentNav from Users where Id=p.UserId)," + BrandId + ",UserId,ProfitType,sum(CreditTradeProfit+DebitNonTradeCapProfit+DebitTradeCapProfit) from ProfitRewardRecord p where CheckStatus=0 and BrandId=" + BrandId + " and UserId>0 and TradeMonth='" + date + "' group by UserId,ProfitType order by UserId");
-            DataTable dt = OtherMySqlConn.dtable("select UserId,sum(CreditTradeProfit+DebitNonTradeCapProfit+DebitTradeCapProfit) from ProfitRewardRecord where CheckStatus=0 and BrandId=" + BrandId + " and UserId>0 and TradeMonth='" + date + "' group by UserId");
+            string StartId = function.ReadInstance("/PublicParams/ProfitRewardRecordId" + date + ".txt");
+            if(string.IsNullOrEmpty(StartId))
+            {
+                StartId = "0";
+            }
+            OtherMySqlConn.op("insert into ProfitRecord (CreateDate,CreateMan,SeoTitle,ParentNav,BrandId,UserId,DirectFlag,ProfitAmount) select now(),'root','" + date + "',(select ParentNav from Users where Id=p.UserId)," + BrandId + ",UserId,ProfitType,sum(CreditTradeProfit+DebitNonTradeCapProfit+DebitTradeCapProfit) from ProfitRewardRecord p where Id>=" + StartId + " and CheckStatus=0 and BrandId=" + BrandId + " and UserId>0 and TradeMonth='" + date + "' group by UserId,ProfitType order by UserId");
+            DataTable dt = OtherMySqlConn.dtable("select UserId,sum(CreditTradeProfit+DebitNonTradeCapProfit+DebitTradeCapProfit) from ProfitRewardRecord where Id>=" + StartId + " and CheckStatus=0 and BrandId=" + BrandId + " and UserId>0 and TradeMonth='" + date + "' group by UserId");
             function.WriteLog("分润:" + BrandId + ":" + dt.Rows.Count, "同步分润数据");
             int index = 0;
             foreach (DataRow dr in dt.Rows)
@@ -75,18 +80,8 @@ namespace MySystem
                 decimal ProfitMoney = decimal.Parse(dr[1].ToString());
                 try
                 {
-                    string IdBrand = UserId + "_" + BrandId;
-                    UserMachineData MachineData = db.UserMachineData.FirstOrDefault(m => m.IdBrand == IdBrand);
-                    if (MachineData == null)
-                    {
-                        MachineData = db.UserMachineData.Add(new UserMachineData()
-                        {
-                            IdBrand = IdBrand,
-                        }).Entity;
-                        db.SaveChanges();
-                    }
-                    MachineData.TradeProfit += ProfitMoney;
-                    db.SaveChanges();
+                    string content = UserId + "|" + BrandId + "|" + ProfitMoney + "|" + index;
+                    RedisDbconn.Instance.AddList("DoTradeProfitQueue", content);
                 }
                 catch (Exception ex)
                 {
@@ -94,73 +89,88 @@ namespace MySystem
                 }
                 function.WriteLog(index.ToString(), "同步分润数据");
             }
-            OtherMySqlConn.op("update ProfitRewardRecord set CheckStatus=1 where CheckStatus=0 and BrandId=" + BrandId + " and UserId>0 and TradeMonth='" + date + "'");
-                
+            OtherMySqlConn.op("update ProfitRewardRecord set CheckStatus=1 where Id>=" + StartId + " and CheckStatus=0 and BrandId=" + BrandId + " and UserId>0 and TradeMonth='" + date + "'");
+
             db.Dispose();
+            dt.Dispose();
+
+            RedisDbconn.Instance.AddList("DoTradeProfitQueue", "end");
+            SycnProfitServiceV2.Instance.StartProfit();
         }
         private void DoTradeProfit2(int BrandId, string date, string SysUserName)
         {
             WebCMSEntities db = new WebCMSEntities();
             OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-            
-            DataTable dt = OtherMySqlConn.dtable("select UserId,DirectFlag,ProfitAmount from ProfitRecord where BrandId=" + BrandId + " and SeoTitle='" + date + "' and Version=0 and UserId>0");
-            function.WriteLog("分润:" + BrandId + ":" + dt.Rows.Count, "同步分润数据");
-            int index = 0;
-            foreach (DataRow dr in dt.Rows)
+            int startid = 0;
+            bool op = true;
+            while(op)
             {
-                index += 1;
-                int UserId = int.Parse(dr["UserId"].ToString());
-                int DirectFlag = int.Parse(dr["DirectFlag"].ToString());
-                decimal ProfitAmount = decimal.Parse(dr["ProfitAmount"].ToString());
-                var tran = db.Database.BeginTransaction();
-                try
+                DataTable dt = OtherMySqlConn.dtable("select Id,UserId,DirectFlag,ProfitAmount from ProfitRecord where Id>" + startid + " and BrandId=" + BrandId + " and SeoTitle='" + date + "' and Version=0 and UserId>0 order by Id limit 200");
+                if(dt.Rows.Count > 0)
                 {
-                    UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == UserId);
-                    if (account == null)
+                    function.WriteLog("分润:" + BrandId + ":" + dt.Rows.Count, "同步分润数据");
+                    int index = 0;
+                    foreach (DataRow dr in dt.Rows)
                     {
-                        account = db.UserAccount.Add(new UserAccount()
+                        index += 1;
+                        int UserId = int.Parse(dr["UserId"].ToString());
+                        int DirectFlag = int.Parse(dr["DirectFlag"].ToString());
+                        decimal ProfitAmount = decimal.Parse(dr["ProfitAmount"].ToString());
+                        var tran = db.Database.BeginTransaction();
+                        try
                         {
-                            Id = UserId,
-                            UserId = UserId,
-                        }).Entity;
-                        db.SaveChanges();
+                            UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == UserId);
+                            if (account == null)
+                            {
+                                account = db.UserAccount.Add(new UserAccount()
+                                {
+                                    Id = UserId,
+                                    UserId = UserId,
+                                }).Entity;
+                                db.SaveChanges();
+                            }
+                            decimal BeforeTotalAmount = account.TotalAmount; //变更前总金额
+                            decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
+                            decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
+                            account.BalanceAmount += ProfitAmount;
+                            account.TotalAmount += ProfitAmount;
+                            decimal AfterTotalAmount = account.TotalAmount; //变更后总金额
+                            decimal AfterFreezeAmount = account.FreezeAmount; //变更后冻结金额
+                            decimal AfterBalanceAmount = account.BalanceAmount; //变更后余额
+                            UserAccountRecord userAccountRecord = db.UserAccountRecord.Add(new UserAccountRecord()
+                            {
+                                CreateDate = DateTime.Now,
+                                UpdateDate = DateTime.Now,
+                                UserId = UserId, //创客
+                                ProductType = BrandId,
+                                ChangeType = 1, //变动类型
+                                ChangeAmount = ProfitAmount, //变更金额
+                                BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
+                                AfterTotalAmount = AfterTotalAmount, //变更后总金额
+                                BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
+                                AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
+                                BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
+                                AfterBalanceAmount = AfterBalanceAmount, //变更后余额
+                                Remark = DirectFlag == 1 ? "直拓商户分润" : "品牌推广服务费",
+                            }).Entity;
+                            db.SaveChanges();
+                            tran.Commit();
+                        }
+                        catch (Exception ex)
+                        {
+                            function.WriteLog(DateTime.Now.ToString() + "\n" + UserId + "," + ProfitAmount + "\n" + ex.ToString(), "同步到余额异常");
+                            tran.Rollback();
+                        }
+                        startid = int.Parse(dr["Id"].ToString());
+                        function.WriteLog(index.ToString(), "同步分润数据");
                     }
-                    decimal BeforeTotalAmount = account.TotalAmount; //变更前总金额
-                    decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
-                    decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
-                    account.BalanceAmount += ProfitAmount;
-                    account.TotalAmount += ProfitAmount;
-                    decimal AfterTotalAmount = account.TotalAmount; //变更后总金额
-                    decimal AfterFreezeAmount = account.FreezeAmount; //变更后冻结金额
-                    decimal AfterBalanceAmount = account.BalanceAmount; //变更后余额
-                    UserAccountRecord userAccountRecord = db.UserAccountRecord.Add(new UserAccountRecord()
-                    {
-                        CreateDate = DateTime.Now,
-                        UpdateDate = DateTime.Now,
-                        UserId = UserId, //创客
-                        ProductType = BrandId,
-                        ChangeType = 1, //变动类型
-                        ChangeAmount = ProfitAmount, //变更金额
-                        BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
-                        AfterTotalAmount = AfterTotalAmount, //变更后总金额
-                        BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
-                        AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
-                        BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
-                        AfterBalanceAmount = AfterBalanceAmount, //变更后余额
-                        Remark = DirectFlag == 1 ? "直拓商户分润" : "品牌推广服务费",
-                    }).Entity;
-                    db.SaveChanges();
-                    tran.Commit();
                 }
-                catch (Exception ex)
+                else
                 {
-                    function.WriteLog(DateTime.Now.ToString() + "\n" + UserId + "," + ProfitAmount + "\n" + ex.ToString(), "同步到余额异常");
-                    tran.Rollback();
+                    op = false;
                 }
-                function.WriteLog(index.ToString(), "同步分润数据");
             }
             OtherMySqlConn.dtable("update ProfitRecord set Version=1 where BrandId=" + BrandId + " and SeoTitle='" + date + "' and Version=0 and UserId>0");
-                
             db.Dispose();
         }
 
@@ -170,8 +180,16 @@ namespace MySystem
         {
             WebCMSEntities db = new WebCMSEntities();
             OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
+
+            string StartId = function.ReadInstance("/PublicParams/ProfitSubsidyDetailId" + date + ".txt");
+            if(string.IsNullOrEmpty(StartId))
+            {
+                StartId = "0";
+            }
             
-            DataTable dt = OtherMySqlConn.dtable("select SubsidyUserId,sum(SubsidyProfitRate) from ProfitSubsidyDetail where Status=0 and BrandId=" + BrandId + " and TradeMonth='" + date + "' GROUP BY SubsidyUserId");
+            OtherMySqlConn.op("insert into SubsidyRecord (CreateDate,SeoKeyword,SeoTitle,ParentNav,BrandId,UserId,ProfitAmount) select now(),'root','" + date + "',(select ParentNav from Users where Id=p.SubsidyUserId)," + BrandId + ",SubsidyUserId,sum(SubsidyProfitRate) from ProfitSubsidyDetail p where Id>=" + StartId + " and Status=0 and BrandId=" + BrandId + " and TradeMonth='" + date + "' GROUP BY SubsidyUserId");
+
+            DataTable dt = OtherMySqlConn.dtable("select SubsidyUserId,sum(SubsidyProfitRate) from ProfitSubsidyDetail where Id>=" + StartId + " and Status=0 and BrandId=" + BrandId + " and TradeMonth='" + date + "' GROUP BY SubsidyUserId");
             function.WriteLog("补贴:" + BrandId + ":" + dt.Rows.Count, "同步补贴数据");
             int index = 0;
             foreach (DataRow dr in dt.Rows)
@@ -181,94 +199,98 @@ namespace MySystem
                 decimal ProfitMoney = decimal.Parse(dr[1].ToString());
                 try
                 {
-                    Users user = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
-                    string IdBrand = UserId + "_" + BrandId;
-                    UserMachineData MachineData = db.UserMachineData.FirstOrDefault(m => m.IdBrand == IdBrand);
-                    if (MachineData == null)
-                    {
-                        MachineData = db.UserMachineData.Add(new UserMachineData()
-                        {
-                            IdBrand = IdBrand,
-                        }).Entity;
-                        db.SaveChanges();
-                    }
-                    MachineData.OtherProfit += ProfitMoney;
-                    db.SaveChanges();
+                    string content = UserId + "|" + BrandId + "|" + ProfitMoney + "|" + index;
+                    RedisDbconn.Instance.AddList("DoSubsidyProfitQueue", content);
                 }
                 catch (Exception ex)
                 {
                     function.WriteLog(DateTime.Now.ToString() + "\n" + UserId + "," + ProfitMoney + "\n" + ex.ToString(), "同步到补贴异常");
                 }
-                function.WriteLog(index.ToString(), "同步补贴数据");
             }
-            OtherMySqlConn.dtable("update ProfitSubsidyDetail set Status=1 where Status=0 and BrandId=" + BrandId + " and TradeMonth='" + date + "'");
+            OtherMySqlConn.dtable("update ProfitSubsidyDetail set Status=1 where Id>=" + StartId + " and Status=0 and BrandId=" + BrandId + " and TradeMonth='" + date + "'");
                 
             db.Dispose();
+            dt.Dispose();
+            
+            RedisDbconn.Instance.AddList("DoSubsidyProfitQueue", "end");
+            SycnProfitServiceV2.Instance.StartSubsidy();
         }
 
         private void DoSubsidyProfit2(int BrandId, string date)
         {
             WebCMSEntities db = new WebCMSEntities();
             OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-            
-            DataTable dt = OtherMySqlConn.dtable("select SubsidyUserId,sum(SubsidyProfitRate) from ProfitSubsidyDetail where Status=1 and BrandId=" + BrandId + " and TradeMonth='" + date + "' GROUP BY SubsidyUserId");
-            function.WriteLog("补贴:" + BrandId + ":" + dt.Rows.Count, "同步补贴数据");
-            int index = 0;
-            foreach (DataRow dr in dt.Rows)
+            int startid = 0;
+            bool op = true;
+            while(op)
             {
-                index += 1;
-                int UserId = int.Parse(dr["SubsidyUserId"].ToString());
-                decimal ProfitMoney = decimal.Parse(dr[1].ToString());
-                var tran = db.Database.BeginTransaction();
-                try
+                DataTable dt = OtherMySqlConn.dtable("select Id,UserId,ProfitAmount from SubsidyRecord where Id>" + startid + " and BrandId=" + BrandId + " and SeoTitle='" + date + "' and Status=0 and UserId>0 order by Id limit 200");
+                if(dt.Rows.Count > 0)
                 {
-                    Users user = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
-                    UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == UserId);
-                    if (account == null)
+                    function.WriteLog("补贴:" + BrandId + ":" + dt.Rows.Count, "同步补贴数据");
+                    int index = 0;
+                    foreach (DataRow dr in dt.Rows)
                     {
-                        account = db.UserAccount.Add(new UserAccount()
+                        index += 1;
+                        int UserId = int.Parse(dr["UserId"].ToString());
+                        decimal ProfitMoney = decimal.Parse(dr["ProfitAmount"].ToString());
+                        var tran = db.Database.BeginTransaction();
+                        try
                         {
-                            Id = UserId,
-                            UserId = UserId,
-                        }).Entity;
-                        db.SaveChanges();
+                            Users user = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
+                            UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == UserId);
+                            if (account == null)
+                            {
+                                account = db.UserAccount.Add(new UserAccount()
+                                {
+                                    Id = UserId,
+                                    UserId = UserId,
+                                }).Entity;
+                                db.SaveChanges();
+                            }
+                            decimal BeforeTotalAmount = account.TotalAmount; //变更前总金额
+                            decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
+                            decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
+                            account.BalanceAmount += ProfitMoney;
+                            account.TotalAmount += ProfitMoney;
+                            decimal AfterTotalAmount = account.TotalAmount; //变更后总金额
+                            decimal AfterFreezeAmount = account.FreezeAmount; //变更后冻结金额
+                            decimal AfterBalanceAmount = account.BalanceAmount; //变更后余额
+                            UserAccountRecord userAccountRecord = db.UserAccountRecord.Add(new UserAccountRecord()
+                            {
+                                CreateDate = DateTime.Now,
+                                UpdateDate = DateTime.Now,
+                                UserId = UserId, //创客
+                                ProductType = BrandId,
+                                ChangeType = 111, //变动类型
+                                ChangeAmount = ProfitMoney, //变更金额
+                                BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
+                                AfterTotalAmount = AfterTotalAmount, //变更后总金额
+                                BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
+                                AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
+                                BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
+                                AfterBalanceAmount = AfterBalanceAmount, //变更后余额
+                                Remark = "直拓商户补贴",
+                            }).Entity;
+                            db.SaveChanges();
+                            tran.Commit();
+                        }
+                        catch (Exception ex)
+                        {
+                            function.WriteLog(DateTime.Now.ToString() + "\n" + UserId + "," + ProfitMoney + "\n" + ex.ToString(), "同步到补贴异常");
+                            tran.Rollback();
+                        }
+                        startid = int.Parse(dr["Id"].ToString());
+                        function.WriteLog(index.ToString(), "同步补贴数据");
                     }
-                    decimal BeforeTotalAmount = account.TotalAmount; //变更前总金额
-                    decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
-                    decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
-                    account.BalanceAmount += ProfitMoney;
-                    account.TotalAmount += ProfitMoney;
-                    decimal AfterTotalAmount = account.TotalAmount; //变更后总金额
-                    decimal AfterFreezeAmount = account.FreezeAmount; //变更后冻结金额
-                    decimal AfterBalanceAmount = account.BalanceAmount; //变更后余额
-                    UserAccountRecord userAccountRecord = db.UserAccountRecord.Add(new UserAccountRecord()
-                    {
-                        CreateDate = DateTime.Now,
-                        UpdateDate = DateTime.Now,
-                        UserId = UserId, //创客
-                        ProductType = BrandId,
-                        ChangeType = 111, //变动类型
-                        ChangeAmount = ProfitMoney, //变更金额
-                        BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
-                        AfterTotalAmount = AfterTotalAmount, //变更后总金额
-                        BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
-                        AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
-                        BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
-                        AfterBalanceAmount = AfterBalanceAmount, //变更后余额
-                        Remark = "直拓商户补贴",
-                    }).Entity;
-                    db.SaveChanges();
-                    tran.Commit();
                 }
-                catch (Exception ex)
+                else
                 {
-                    function.WriteLog(DateTime.Now.ToString() + "\n" + UserId + "," + ProfitMoney + "\n" + ex.ToString(), "同步到补贴异常");
-                    tran.Rollback();
+                    op = false;
                 }
-                function.WriteLog(index.ToString(), "同步补贴数据");
             }
-            OtherMySqlConn.dtable("update ProfitSubsidyDetail set Status=2 where Status=1 and BrandId=" + BrandId + " and TradeMonth='" + date + "'");
-                
+            OtherMySqlConn.dtable("update SubsidyRecord set Status=1 where BrandId=" + BrandId + " and SeoTitle='" + date + "' and Status=0 and UserId>0");
+
             db.Dispose();
         }
 
@@ -354,5 +376,133 @@ namespace MySystem
         }
 
         #endregion
+
+
+
+
+
+
+
+
+
+
+
+        public void StartProfit()
+        {
+            Thread th = new Thread(StartProfitDo);
+            th.IsBackground = true;
+            th.Start();
+        }
+
+        public void StartProfitDo()
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            bool op = true;
+            while (op)
+            {
+                string content = RedisDbconn.Instance.RPop<string>("DoTradeProfitQueue");
+                if (!string.IsNullOrEmpty(content))
+                {
+                    if(content == "end")
+                    {
+                        op = false;
+                    }
+                    else
+                    {
+                        try
+                        {
+                            string[] data = content.Split('|');
+                            int UserId = int.Parse(data[0]);
+                            int BrandId = int.Parse(data[1]);
+                            decimal ProfitMoney = decimal.Parse(data[2]);
+                            int index = int.Parse(data[3]);
+                            
+                            string IdBrand = UserId + "_" + BrandId;
+                            UserMachineData MachineData = db.UserMachineData.FirstOrDefault(m => m.IdBrand == IdBrand);
+                            if (MachineData == null)
+                            {
+                                MachineData = db.UserMachineData.Add(new UserMachineData()
+                                {
+                                    IdBrand = IdBrand,
+                                }).Entity;
+                                db.SaveChanges();
+                            }
+                            MachineData.TradeProfit += ProfitMoney;
+                            db.SaveChanges();
+
+                            function.WriteLog(index.ToString() + "--" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), "同步分润队列数据");
+                        }
+                        catch (Exception ex)
+                        {
+                            function.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "同步分润队列数据异常");
+                        }
+                    }
+                }
+                else
+                {
+                    Thread.Sleep(1000);
+                }
+            }
+            db.Dispose();
+        }
+
+        public void StartSubsidy()
+        {
+            Thread th = new Thread(StartSubsidyDo);
+            th.IsBackground = true;
+            th.Start();
+        }
+
+        public void StartSubsidyDo()
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            bool op = true;
+            while (op)
+            {
+                string content = RedisDbconn.Instance.RPop<string>("DoSubsidyProfitQueue");
+                if (!string.IsNullOrEmpty(content))
+                {
+                    if(content == "end")
+                    {
+                        op = false;
+                    }
+                    else
+                    {
+                        try
+                        {
+                            string[] data = content.Split('|');
+                            int UserId = int.Parse(data[0]);
+                            int BrandId = int.Parse(data[1]);
+                            decimal ProfitMoney = decimal.Parse(data[2]);
+                            int index = int.Parse(data[3]);
+
+                            string IdBrand = UserId + "_" + BrandId;
+                            UserMachineData MachineData = db.UserMachineData.FirstOrDefault(m => m.IdBrand == IdBrand);
+                            if (MachineData == null)
+                            {
+                                MachineData = db.UserMachineData.Add(new UserMachineData()
+                                {
+                                    IdBrand = IdBrand,
+                                }).Entity;
+                                db.SaveChanges();
+                            }
+                            MachineData.OtherProfit += ProfitMoney;
+                            db.SaveChanges();
+
+                            function.WriteLog(index.ToString() + "--" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), "同步补贴队列数据");
+                        }
+                        catch (Exception ex)
+                        {
+                            function.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "同步补贴队列数据异常");
+                        }
+                    }
+                }
+                else
+                {
+                    Thread.Sleep(1000);
+                }
+            }
+            db.Dispose();
+        }
     }
 }

+ 2 - 2
AppStart/OssHelper.cs

@@ -12,8 +12,8 @@ namespace MySystem
 {
     public class OssHelper
     {
-        string key = "LTAI5t7ivibdYZTro4SRVZ9M"; //阿里云AccessKey ID
-        string secret = "nfr1bmbJbMhLuaj10iBORkuFfIAX7M";  //阿里云Access Key Secret
+        string key = "LTAI5tAp9ASZtq4wYzuXfeer"; //阿里云AccessKey ID
+        string secret = "N0o6TwowU8r4aeNWoefMnnus9Q2saW";  //阿里云Access Key Secret
         public string PathName = ConfigurationManager.AppSettings["Database"].ToString();
         public string endpoint = "oss-cn-chengdu.aliyuncs.com";  //endpoint
         public string bucketName = "kexiaoshuang";

+ 0 - 90
AppStart/SetDesposit.cs

@@ -1,90 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Data;
-using System.Linq;
-using System.Threading;
-using MySystem.Models;
-using Library;
-
-namespace MySystem
-{
-    /// <summary>
-    /// 设置预发机超过30天预发押金自动扣减
-    /// </summary>
-    public class SetDesposit
-    {
-        public readonly static SetDesposit Instance = new SetDesposit();
-        private SetDesposit()
-        { }
-
-        public void Start()
-        {
-            Thread th = new Thread(doSomething);
-            th.IsBackground = true;
-            th.Start();
-        }
-
-        public void doSomething()
-        {
-            while (true)
-            {
-                if (DateTime.Now.Hour > 0 && DateTime.Now.Hour < 17)
-                {
-                    try
-                    {
-                        string check = function.ReadInstance("/SetDesposit/check" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt");
-                        if (string.IsNullOrEmpty(check))
-                        {
-                            function.WritePage("/SetDesposit/", "check" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt", DateTime.Now.ToString("HH:mm:ss"));
-                            WebCMSEntities db = new WebCMSEntities();
-                            var date = DateTime.Now.AddDays(-30);
-                            bool op = true;
-                            while (op)
-                            {
-                                var smallPos = db.PreSendStockDetail.Where(m => m.Status == 1 && m.Sort == 0 && m.CreateDate <= date && m.ApplyFlag == 0).ToList();
-                                foreach (var item in smallPos)
-                                {
-                                    var tuserAccount = db.UserAccount.FirstOrDefault(m => m.Id == item.ToUserId) ?? new UserAccount();
-                                    var brandInfo = db.KqProducts.FirstOrDefault(m => m.Id == item.BrandId);
-                                    var amount = 0;
-                                    if (brandInfo.Name.Contains("电签"))
-                                    {
-                                        amount = 200;
-                                    }
-                                    if (brandInfo.Name.Contains("大POS"))
-                                    {
-                                        amount = 300;
-                                    }
-                                    if (tuserAccount.Id > 0)
-                                    {
-                                        tuserAccount.SmallStoreDeposit += amount;//添加小分仓押金
-                                        var add = db.UserAccountRecord.Add(new UserAccountRecord()
-                                        {
-                                            CreateDate = DateTime.Now,
-                                            Remark = "小分仓押金暂扣",
-                                            ChangeType = 63,
-                                            BeforeBalanceAmount = tuserAccount.SmallStoreDeposit - amount, //变更前余额
-                                            AfterBalanceAmount = tuserAccount.SmallStoreDeposit, //变更后余额
-                                            ChangeAmount = amount, //变更金额
-                                            UserId = item.ToUserId,
-
-                                        }).Entity;
-                                        db.SaveChanges();
-                                    }
-                                    item.Sort = 1;
-                                    db.SaveChanges();
-                                }
-                            }
-                            db.Dispose();
-                        }
-                    }
-                    catch (Exception ex)
-                    {
-                        function.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "设置预发机超过30天预发押金自动扣减异常");
-                    }
-                }
-                Thread.Sleep(5000);
-            }
-        }
-    }
-}

+ 13 - 0
AppStart/Tables/ProgressUserList.cs

@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+namespace MySystem
+{
+    public class ProgressUserList
+    {
+        public decimal LastMonth { get; set; }
+        public decimal ThisMonth { get; set; }
+        public int IsOk { get; set; }
+        public int UserId { get; set; }
+        public string ParentNav { get; set; }
+    }
+}

+ 1 - 0
Areas/Admin/Controllers/BsServer/BaseController.cs

@@ -101,6 +101,7 @@ namespace MySystem.Areas.Admin.Controllers
             if(url.Contains("/SystemSet/")) return true;
             if(url.Contains("Task")) return true;
             if(url.Contains("ProfitObject")) return true;
+            if(url.Contains("ExportTable")) return true;
             if (url.Contains("/KqProductBrand/"))
             {
                 url = url.Replace("/KqProductBrand/", "/KqProducts/");

+ 48 - 48
Areas/Admin/Controllers/HomeController.cs

@@ -149,60 +149,60 @@ namespace MySystem.Areas.Admin.Controllers
         [HttpPost]
         public string Login(string UserName, string Pwd, string CheckCode)
         {
-            // string result = "";
-            // if (function.GetCookie(_accessor.HttpContext, "checkcode") != CheckCode)
-            // {
-            //     result = "验证码错误!!";
-            // }
-            // else
-            // {
-            //     Pwd = function.MD5_32(Pwd);
-            //     var user = db.SysAdmin.FirstOrDefault(m => m.AdminName == UserName && m.Password == Pwd);
-            //     if (user != null)
-            //     {
-            //         user.LastLoginDate = DateTime.Now;
-            //         db.SaveChanges();
-            //         function.WriteCookie(_accessor.HttpContext, "SysUserName", user.AdminName);
-            //         function.WriteCookie(_accessor.HttpContext, "SysRealName", user.RealName);
-            //         function.WriteCookie(_accessor.HttpContext, "SysRealRole", user.Role);
-            //         int RoleId = int.Parse(function.CheckInt(user.Role));
-            //         BsModels.SysAdminRole Role = db.SysAdminRole.FirstOrDefault(m => m.Id == RoleId) ?? new BsModels.SysAdminRole();
-            //         string RightInfo = function.CheckNull(Role.RightInfo);
-            //         function.WriteSession(_accessor.HttpContext, "RightInfo", RightInfo);
-            //         string UserId = user.Id.ToString();
-            //         function.WriteCookie(_accessor.HttpContext, "SysId", UserId);
-            //         function.WriteSession(_accessor.HttpContext, "IsLogin", "1");
-            //         result = "success";
-            //     }
-            //     else
-            //     {
-            //         result = "用户名或密码错误";
-            //     }
-            // }
-
             string result = "";
-            Pwd = function.MD5_32(Pwd);
-            var user = db.SysAdmin.FirstOrDefault(m => m.AdminName == UserName && m.Password == Pwd);
-            if (user != null)
+            if (function.GetCookie(_accessor.HttpContext, "checkcode") != CheckCode)
             {
-                user.LastLoginDate = DateTime.Now;
-                db.SaveChanges();
-                function.WriteCookie(_accessor.HttpContext, "SysUserName", user.AdminName);
-                function.WriteCookie(_accessor.HttpContext, "SysRealName", user.RealName);
-                function.WriteCookie(_accessor.HttpContext, "SysRealRole", user.Role);
-                int RoleId = int.Parse(function.CheckInt(user.Role));
-                BsModels.SysAdminRole Role = db.SysAdminRole.FirstOrDefault(m => m.Id == RoleId) ?? new BsModels.SysAdminRole();
-                string RightInfo = function.CheckNull(Role.RightInfo);
-                function.WriteSession(_accessor.HttpContext, "RightInfo", RightInfo);
-                string UserId = user.Id.ToString();
-                function.WriteCookie(_accessor.HttpContext, "SysId", UserId);
-                function.WriteSession(_accessor.HttpContext, "IsLogin", "1");
-                result = "success";
+                result = "验证码错误!!";
             }
             else
             {
-                result = "用户名或密码错误";
+                Pwd = function.MD5_32(Pwd);
+                var user = db.SysAdmin.FirstOrDefault(m => m.AdminName == UserName && m.Password == Pwd);
+                if (user != null)
+                {
+                    user.LastLoginDate = DateTime.Now;
+                    db.SaveChanges();
+                    function.WriteCookie(_accessor.HttpContext, "SysUserName", user.AdminName);
+                    function.WriteCookie(_accessor.HttpContext, "SysRealName", user.RealName);
+                    function.WriteCookie(_accessor.HttpContext, "SysRealRole", user.Role);
+                    int RoleId = int.Parse(function.CheckInt(user.Role));
+                    BsModels.SysAdminRole Role = db.SysAdminRole.FirstOrDefault(m => m.Id == RoleId) ?? new BsModels.SysAdminRole();
+                    string RightInfo = function.CheckNull(Role.RightInfo);
+                    function.WriteSession(_accessor.HttpContext, "RightInfo", RightInfo);
+                    string UserId = user.Id.ToString();
+                    function.WriteCookie(_accessor.HttpContext, "SysId", UserId);
+                    function.WriteSession(_accessor.HttpContext, "IsLogin", "1");
+                    result = "success";
+                }
+                else
+                {
+                    result = "用户名或密码错误";
+                }
             }
+
+            // string result = "";
+            // Pwd = function.MD5_32(Pwd);
+            // var user = db.SysAdmin.FirstOrDefault(m => m.AdminName == UserName && m.Password == Pwd);
+            // if (user != null)
+            // {
+            //     user.LastLoginDate = DateTime.Now;
+            //     db.SaveChanges();
+            //     function.WriteCookie(_accessor.HttpContext, "SysUserName", user.AdminName);
+            //     function.WriteCookie(_accessor.HttpContext, "SysRealName", user.RealName);
+            //     function.WriteCookie(_accessor.HttpContext, "SysRealRole", user.Role);
+            //     int RoleId = int.Parse(function.CheckInt(user.Role));
+            //     BsModels.SysAdminRole Role = db.SysAdminRole.FirstOrDefault(m => m.Id == RoleId) ?? new BsModels.SysAdminRole();
+            //     string RightInfo = function.CheckNull(Role.RightInfo);
+            //     function.WriteSession(_accessor.HttpContext, "RightInfo", RightInfo);
+            //     string UserId = user.Id.ToString();
+            //     function.WriteCookie(_accessor.HttpContext, "SysId", UserId);
+            //     function.WriteSession(_accessor.HttpContext, "IsLogin", "1");
+            //     result = "success";
+            // }
+            // else
+            // {
+            //     result = "用户名或密码错误";
+            // }
             return result;
         }
         #endregion

+ 28 - 0
Areas/Admin/Controllers/MainServer/ExportTableController.cs

@@ -0,0 +1,28 @@
+using System;
+using System.Web;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Data;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using MySystem.Models;
+using Library;
+using LitJson;
+using MySystemLib;
+
+namespace MySystem.Areas.Admin.Controllers
+{
+    [Area("Admin")]
+    [Route("Admin/[controller]/[action]")]
+    public class ExportTableController : BaseController
+    {
+        public ExportTableController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
+        {
+            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
+        }
+
+    }
+}

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

@@ -387,7 +387,7 @@ namespace MySystem.Areas.Admin.Controllers
             if (string.IsNullOrEmpty(check))
             {
                 function.WritePage("/HelpBalance/", date + OpTypeString + ".txt", DateTime.Now.ToString());
-                RedisDbconn.Instance.AddList("SycnHelpProfitQueue", date + "#cut#" + OpType + "#cut#" + SysUserName);
+                RedisDbconn.Instance.AddList("SycnHelpProfitQueue2", date + "#cut#" + OpType + "#cut#" + SysUserName);
                 return "success";
             }
             return date + "分润已同步,请勿重复操作";

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

@@ -59,7 +59,7 @@ namespace MySystem.Areas.Admin.Controllers
             Fields.Add("PosSn", "1"); //SN编号
             Fields.Add("BrandId", "0"); //品牌
 
-            string condition = " and Status>-1 AND BindingState = 1 AND DATE_SUB(CURDATE(), INTERVAL 180 DAY) >= date(BindingTime) and DownFeeFlag =0";
+            string condition = " and Status>-1 AND BindingState = 1 AND DATE_SUB(CURDATE(), INTERVAL 180 DAY) >= date(BindingTime) and UpFeeFlag=1 and DownFeeFlag=0 and SeoDescription!='设置成功'";
             //绑定状态
             if (!string.IsNullOrEmpty(BindingStateSelect))
             {
@@ -463,15 +463,15 @@ namespace MySystem.Areas.Admin.Controllers
         /// <returns></returns>
         public string BatchSetting(string Id)
         {
-            string[] idlist = Id.Split(new char[] { ',' });
+            // string[] idlist = Id.Split(new char[] { ',' });
             AddSysLog(Id, "PosMachinesTwo", "UpFeePosMachinesTwo");
             List<int> posIds = new List<int>();
             List<int> upposIds = new List<int>();
             string userIds = "";
-            foreach (string subids in idlist)
+            DateTime check = DateTime.Now.AddDays(-180);
+            List<PosMachinesTwo> poslist = db.PosMachinesTwo.Where(m => m.Status > -1 && m.BindingState == 1 && m.UpFeeFlag == 1 && m.DownFeeFlag == 0 && m.BindingTime <= check && m.SeoDescription != "设置成功").ToList();
+            foreach (PosMachinesTwo pos in poslist)
             {
-                int id = int.Parse(subids);
-                var pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == id) ?? new PosMachinesTwo();
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("UpFeeFlag", 1);
                 Fields.Add("UpFeeMan", SysUserName);
@@ -487,14 +487,14 @@ namespace MySystem.Areas.Admin.Controllers
                     // PosId:机具Id
                     // Kind:1或2,1为费率0.63,2为费率0.6
                     // OpMan:操作人,app传创客编号,后台传SysUserName
-                    string info = "{\"RecordId\":\"\",\"PosId\":\"" + id + "\",\"Fee\": \"" + 0.63 + "\",\"Kind\": \"" + 1 + "\",\"OpMan\": \"" + SysUserName + "\"}";
+                    string info = "{\"RecordId\":\"\",\"PosId\":\"" + pos.Id + "\",\"Fee\": \"" + 0.63 + "\",\"Kind\": \"" + 1 + "\",\"OpMan\": \"" + SysUserName + "\"}";
                     RedisDbconn.Instance.AddList("SetDepositPostQueue", info);
                 }
                 else
                 {
-                    upposIds.Add(id);
+                    upposIds.Add(pos.Id);
                 }
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("PosMachinesTwo", Fields, id);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("PosMachinesTwo", Fields, pos.Id);
 
             }
             // string[] lists = userIds.TrimEnd(',').Split(new char[] { ',' });

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

@@ -553,7 +553,7 @@ namespace MySystem.Areas.Admin.Controllers
                 function.WritePage("/Balance/" + BrandId + "/", date + OpTypeString + ".txt", DateTime.Now.ToString());
                 // DoTradeProfit(BrandId, date, OpType);
                 // DoSubsidyProfit(BrandId, date, OpType);
-                RedisDbconn.Instance.AddList("SycnProfitQueue2", BrandId + "#cut#" + date + "#cut#" + OpType + "#cut#" + SysUserName);
+                RedisDbconn.Instance.AddList("SycnProfitQueue3", BrandId + "#cut#" + date + "#cut#" + OpType + "#cut#" + SysUserName);
                 return "success";
             }
             return date + "分润已同步,请勿重复操作";

+ 43 - 36
Areas/Admin/Controllers/MainServer/SysToolsController.cs

@@ -355,41 +355,41 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 pos.BindMerchantId = merchant.Id;
             }
-            var makerCode = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == MakerCode) ?? new UserForMakerCode();
-            var prePos = db.PreSendStockDetail.FirstOrDefault(m => m.ToUserId == makerCode.UserId && m.SnId == pos.Id && m.CreateDate < DateTime.Now.AddDays(-30) && m.AuthFlag == 1 && m.ApplyFlag == 0) ?? new PreSendStockDetail();
-            if (makerCode.UserId > 0 && prePos.Id > 0)
-            {
-                if (prePos.CreateDate <= DateTime.Now.AddDays(-30))
-                {
-                    var brandInfo = db.KqProducts.FirstOrDefault(m => m.Id == prePos.BrandId);
-                    var amount = 0;
-                    if (brandInfo.Name.Contains("电签"))
-                    {
-                        amount = 200;
-                    }
-                    if (brandInfo.Name.Contains("大POS"))
-                    {
-                        amount = 300;
-                    }
-                    var userAccount = db.UserAccount.FirstOrDefault(m => m.Id == makerCode.UserId) ?? new UserAccount();
-                    if (userAccount.Id > 0)
-                    {
-                        userAccount.SmallStoreDeposit -= amount;
-                        var add = db.UserAccountRecord.Add(new UserAccountRecord()
-                        {
-                            CreateDate = DateTime.Now,
-                            Remark = "小分仓押金退还",
-                            ChangeType = 65,
-                            BeforeBalanceAmount = userAccount.SmallStoreDeposit + amount, //变更前小分仓押金
-                            AfterBalanceAmount = userAccount.SmallStoreDeposit, //变更后小分仓押金
-                            ChangeAmount = amount,//变动金额
-                            UserId = userAccount.Id,
-
-                        }).Entity;
-                        db.SaveChanges();
-                    }
-                }
-            }
+            // var makerCode = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == MakerCode) ?? new UserForMakerCode();
+            // var prePos = db.PreSendStockDetail.FirstOrDefault(m => m.ToUserId == makerCode.UserId && m.SnId == pos.Id && m.CreateDate < DateTime.Now.AddDays(-30) && m.AuthFlag == 1 && m.ApplyFlag == 0) ?? new PreSendStockDetail();
+            // if (makerCode.UserId > 0 && prePos.Id > 0)
+            // {
+            //     if (prePos.CreateDate <= DateTime.Now.AddDays(-30))
+            //     {
+            //         var brandInfo = db.KqProducts.FirstOrDefault(m => m.Id == prePos.BrandId);
+            //         var amount = 0;
+            //         if (brandInfo.Name.Contains("电签"))
+            //         {
+            //             amount = 200;
+            //         }
+            //         if (brandInfo.Name.Contains("大POS"))
+            //         {
+            //             amount = 300;
+            //         }
+            //         var userAccount = db.UserAccount.FirstOrDefault(m => m.Id == makerCode.UserId) ?? new UserAccount();
+            //         if (userAccount.Id > 0)
+            //         {
+            //             userAccount.SmallStoreDeposit -= amount;
+            //             var add = db.UserAccountRecord.Add(new UserAccountRecord()
+            //             {
+            //                 CreateDate = DateTime.Now,
+            //                 Remark = "小分仓押金退还",
+            //                 ChangeType = 65,
+            //                 BeforeBalanceAmount = userAccount.SmallStoreDeposit + amount, //变更前小分仓押金
+            //                 AfterBalanceAmount = userAccount.SmallStoreDeposit, //变更后小分仓押金
+            //                 ChangeAmount = amount,//变动金额
+            //                 UserId = userAccount.Id,
+
+            //             }).Entity;
+            //             db.SaveChanges();
+            //         }
+            //     }
+            // }
             db.SaveChanges();
             function.WriteLog(DateTime.Now.ToString() + "\n" + SysUserName + "\nMakerCode:" + MakerCode + ", PosSn:" + PosSn + ", MerNo:" + MerNo + ", AddActPrize:" + AddActPrize + ", IsPre:" + IsPre, "机具补录日志");
             return "success";
@@ -1649,7 +1649,6 @@ namespace MySystem.Areas.Admin.Controllers
                     storeFromUserAcount.ValidAmount += amount;
                     storeBackUserAcount.ValidAmount -= amount;
 
-
                     newpos.BuyUserId = oldpos.BuyUserId;
                     newpos.UserId = oldpos.UserId;
                     newpos.RecycEndDate = oldpos.RecycEndDate;
@@ -1667,6 +1666,7 @@ namespace MySystem.Areas.Admin.Controllers
                     newpos.SeoKeyword = oldpos.SeoKeyword;
                     newpos.PrizeParams = oldpos.PrizeParams;
                     newpos.LeaderUserId = oldpos.LeaderUserId;
+                    newpos.BindMerchantId = oldpos.BindMerchantId;
 
                     newpos.StoreId = oldpos.StoreId;
                     newpos.UserId = oldpos.UserId;
@@ -1676,6 +1676,13 @@ namespace MySystem.Areas.Admin.Controllers
                     oldpos.BuyUserId = 0;
                     oldpos.UserId = 0;
                     oldpos.Status = -1;
+
+                    PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == newpos.BindMerchantId);
+                    if(merchant != null)
+                    {
+                        merchant.KqSnNo = newpos.PosSn;
+                        merchant.ActiveStatus = newpos.ActivationState;
+                    }
                     db.SaveChanges();
 
                     BrokenMachineChange add = db.BrokenMachineChange.Add(new BrokenMachineChange()

+ 15 - 0
Areas/Admin/Views/Home/Index.cshtml

@@ -224,6 +224,21 @@
                                 <dd data-name="grid">
                                     <a lay-href="/Admin/SysTools/CheckMachine2">机具补录</a>
                                 </dd>
+                                <dd data-name="grid">
+                                    <a href="javascript:;" title="每月表格">导出每月表格<span class="layui-nav-more"></span></a>
+                                    <dl class="layui-nav-child">
+                                        <dd data-name="list"><a lay-href="/Admin/ExportTable/Profit" title="分润">分润</a></dd>
+                                        <dd data-name="list"><a lay-href="/Admin/ExportTable/Subsidy" title="补贴">补贴</a></dd>
+                                        <dd data-name="list"><a lay-href="/Admin/ExportTable/Trade?min=3000000&max=10000000" title="交易额300万-1000万名单">交易额300万-1000万名单</a></dd>
+                                        <dd data-name="list"><a lay-href="/Admin/ExportTable/Trade?min=10000000&max=10000000000" title="交易额满1000万名单">交易额满1000万名单</a></dd>
+                                        <dd data-name="list"><a lay-href="/Admin/ExportTable/OpenMachine" title="开机排行">开机排行</a></dd>
+                                        <dd data-name="list"><a lay-href="/Admin/ExportTable/PullNew" title="有效拉新排行">有效拉新排行</a></dd>
+                                        <dd data-name="list"><a lay-href="/Admin/ExportTable/Recommend" title="666推荐王">666推荐王</a></dd>
+                                        <dd data-name="list"><a lay-href="/Admin/ExportTable/Double" title="888翻倍奖">888翻倍奖</a></dd>
+                                        <dd data-name="list"><a lay-href="/Admin/ExportTable/StoreHouse" title="分仓数据">分仓数据</a></dd>
+                                        <dd data-name="list"><a lay-href="/Admin/ExportTable/HelpProfit" title="助利宝分润">助利宝分润</a></dd>
+                                    </dl>
+                                </dd>
                             </dl>
                         </li>
                         }

+ 2 - 2
Areas/Admin/Views/Home/Login.cshtml

@@ -26,11 +26,11 @@
                     <label for="password">密码 / Password</label>
                     <input class="form-input" type="password" name="Pwd" id="Pwd" onKeyUp="if(event.keyCode==13){$('#CheckCode').focus();}" placeholder="请填写密码">
                 </div>
-                @* <div class="form-group pb10">
+                <div class="form-group pb10">
                     <label for="password">验证码 / Verification</label>
                     <input class="form-input" type="text" name="CheckCode" id="CheckCode" onkeyup="if(event.keyCode==13){syslogin();}" placeholder="请填写验证码" style="width: 70%; display: inline-block; margin-right: 2%">
                     <img src="/Api/PublicMethod/CheckCode" onclick="$(this).attr('src','/Api/PublicMethod/CheckCode?r='+Math.random())" style="width: 26%; height:38px;" />
-                </div> *@
+                </div>
                 @*<div class="form-group pb10 cf">
                         <label class="remembermetext fl" for="rememberme">
                             <input type="checkbox" checked name="rememberme">&nbsp;记住我的登录

+ 17 - 0
Areas/Admin/Views/MainServer/ExportTable/Double.cshtml

@@ -0,0 +1,17 @@
+<!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">
+</head>
+
+<body>
+    @Html.Raw(ViewBag.html);
+</body>
+
+</html>

+ 17 - 0
Areas/Admin/Views/MainServer/ExportTable/HelpProfit.cshtml

@@ -0,0 +1,17 @@
+<!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">
+</head>
+
+<body>
+    @Html.Raw(ViewBag.html);
+</body>
+
+</html>

+ 17 - 0
Areas/Admin/Views/MainServer/ExportTable/OpenMachine.cshtml

@@ -0,0 +1,17 @@
+<!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">
+</head>
+
+<body>
+    @Html.Raw(ViewBag.html);
+</body>
+
+</html>

+ 17 - 0
Areas/Admin/Views/MainServer/ExportTable/Profit.cshtml

@@ -0,0 +1,17 @@
+<!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">
+</head>
+
+<body>
+    @Html.Raw(ViewBag.html);
+</body>
+
+</html>

+ 17 - 0
Areas/Admin/Views/MainServer/ExportTable/Recommend.cshtml

@@ -0,0 +1,17 @@
+<!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">
+</head>
+
+<body>
+    @Html.Raw(ViewBag.html);
+</body>
+
+</html>

+ 17 - 0
Areas/Admin/Views/MainServer/ExportTable/StoreHouse.cshtml

@@ -0,0 +1,17 @@
+<!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">
+</head>
+
+<body>
+    @Html.Raw(ViewBag.html);
+</body>
+
+</html>

+ 17 - 0
Areas/Admin/Views/MainServer/ExportTable/Subsidy.cshtml

@@ -0,0 +1,17 @@
+<!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">
+</head>
+
+<body>
+    @Html.Raw(ViewBag.html);
+</body>
+
+</html>

+ 17 - 0
Areas/Admin/Views/MainServer/ExportTable/Trade.cshtml

@@ -0,0 +1,17 @@
+<!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">
+</head>
+
+<body>
+    @Html.Raw(ViewBag.html);
+</body>
+
+</html>

+ 7 - 0
Controllers/HomeController.cs

@@ -172,5 +172,12 @@ namespace MySystem.Controllers
             db.Dispose();
             return html;
         }
+    
+        public string test()
+        {
+            return "ok";
+        }
+    
+    
     }
 }

+ 3 - 3
Models/BackEndOpRecord.cs

@@ -9,11 +9,8 @@ namespace MySystem.Models
         public int Sort { get; set; }
         public int QueryCount { get; set; }
         public int Status { get; set; }
-        public int Version { get; set; }
         public DateTime? CreateDate { get; set; }
         public DateTime? UpdateDate { get; set; }
-        public string CreateMan { get; set; }
-        public string UpdateMan { get; set; }
         public string SeoTitle { get; set; }
         public string SeoKeyword { get; set; }
         public string SeoDescription { get; set; }
@@ -24,5 +21,8 @@ namespace MySystem.Models
         public string TableChName { get; set; }
         public string SysRealName { get; set; }
         public string SysUserName { get; set; }
+        public string CreateMan { get; set; }
+        public string UpdateMan { get; set; }
+        public int Version { get; set; }
     }
 }

+ 3 - 3
Models/LeaderAccountRecord.cs

@@ -9,11 +9,8 @@ namespace MySystem.Models
         public int Sort { get; set; }
         public int QueryCount { get; set; }
         public int Status { get; set; }
-        public int Version { get; set; }
         public DateTime? CreateDate { get; set; }
         public DateTime? UpdateDate { get; set; }
-        public string CreateMan { get; set; }
-        public string UpdateMan { get; set; }
         public string SeoTitle { get; set; }
         public string SeoKeyword { get; set; }
         public string SeoDescription { get; set; }
@@ -29,5 +26,8 @@ namespace MySystem.Models
         public int ProductType { get; set; }
         public int ChangeType { get; set; }
         public int UserId { get; set; }
+        public string CreateMan { get; set; }
+        public string UpdateMan { get; set; }
+        public int Version { get; set; }
     }
 }

+ 2 - 2
Startup.cs

@@ -154,11 +154,11 @@ namespace MySystem
         {
             Dictionary<string, Dictionary<string, string>> tables = new Dictionary<string, Dictionary<string, string>>();
             Library.OtherMySqlConn.connstr = Configuration["Setting:SqlConnStr"];
-            System.Data.DataTable tablecollection = Library.OtherMySqlConn.dtable("select DISTINCT TABLE_NAME from information_schema.columns where table_schema = 'KxsMainServer2'");
+            System.Data.DataTable tablecollection = Library.OtherMySqlConn.dtable("select DISTINCT TABLE_NAME from information_schema.columns where table_schema = 'KxsMainServer'");
             foreach (System.Data.DataRow subtable in tablecollection.Rows)
             {
                 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 = 'KxsMainServer2' 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 = 'KxsMainServer' and TABLE_NAME='" + subtable["TABLE_NAME"].ToString() + "'");
                 foreach (System.Data.DataRow column in columncollection.Rows)
                 {
                     string datatype = column["DATA_TYPE"].ToString();

+ 6 - 5
wwwroot/layuiadmin/modules_main/PosMachinesTwoChange_Admin.js

@@ -153,6 +153,7 @@ layui.config({
             , { field: 'DownFeeFlag', width: 200, title: '调降标记', sort: true }
             , { field: 'DownFeeDate', width: 200, title: '调降时间', sort: true }
             , { field: 'DownFeeMan', width: 200, title: '调降人', sort: true }
+            , { field: 'SeoDescription', width: 500, title: '备注', sort: true }
             , { title: '操作', width: 100, align: 'center', fixed: 'right', toolbar: '#table-list-tools' }
         ]]
         , where: {
@@ -454,10 +455,10 @@ layui.config({
         , BatchSetting: function () {
             var checkStatus = table.checkStatus('LAY-list-manage')
                 , data = checkStatus.data; //得到选中的数据
-            if (data.length < 1) {
-                parent.layer.msg("请选择要设置调升费率的项");
-            } else {
-                var ids = "";
+            // if (data.length < 1) {
+            //     parent.layer.msg("请选择要设置调升费率的项");
+            // } else {
+                var ids = "0";
                 $.each(data, function (index, value) {
                     ids += data[index].Id + ",";
                 });
@@ -484,7 +485,7 @@ layui.config({
                         }
                     });
                 });
-            }
+            // }
         }
         , Open: function () {
             var checkStatus = table.checkStatus('LAY-list-manage')

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
wwwroot/other/oss/upload-min-oss.js


+ 2 - 2
wwwroot/other/oss/upload-min-oss.jsold

@@ -23,8 +23,8 @@ const client = new OSS({
     // yourRegion填写Bucket所在地域。以华东1(杭州)为例,yourRegion填写为oss-cn-hangzhou。
     region: 'oss-cn-chengdu',
     // 从STS服务获取的临时访问密钥(AccessKey ID和AccessKey Secret)。
-    accessKeyId: 'LTAI5t7ivibdYZTro4SRVZ9M',
-    accessKeySecret: 'nfr1bmbJbMhLuaj10iBORkuFfIAX7M',
+    accessKeyId: 'LTAI5tAp9ASZtq4wYzuXfeer',
+    accessKeySecret: 'N0o6TwowU8r4aeNWoefMnnus9Q2saW',
     // 从STS服务获取的安全令牌(SecurityToken)。
     //- stsToken: 'yourSecurityToken',
     // 填写Bucket名称。

Некоторые файлы не были показаны из-за большого количества измененных файлов