Browse Source

修复分润逻辑,盈利期字段有误

lichunlei 2 years ago
parent
commit
02f045ea61
4 changed files with 49 additions and 48 deletions
  1. 6 6
      AppStart/Helper/Profit/ProfitHelperV2.cs
  2. 12 11
      AppStart/Helper/StatService.cs
  3. 29 29
      Startup.cs
  4. 2 2
      appsettings.json

+ 6 - 6
AppStart/Helper/Profit/ProfitHelperV2.cs

@@ -410,7 +410,7 @@ namespace MySystem
                 string sqlstr = "";
                 string sqlstr = "";
                 if (BankCardType == 1)
                 if (BankCardType == 1)
                 {
                 {
-                    sqlstr = "select UserId,QueryCount,sum(HelpDirectTradeAmt),sum(NotHelpDirectTradeAmt),sum(ProfitHelpDirectTradeAmt) from TradeDaySummary where Id>2194000 and TradeDate='" + Date + "' and SeoTitle='self' and BrandId=" + BrandId + " group by UserId,QueryCount having sum(HelpDirectTradeAmt)>0 or sum(NotHelpDirectTradeAmt)>0 or sum(ProfitHelpDirectTradeAmt)>0 order by UserId" + LimitString;
+                    sqlstr = "select UserId,QueryCount,sum(HelpDirectTradeAmt),sum(NotHelpDirectTradeAmt),sum(ProfitDirectTradeAmt) from TradeDaySummary where Id>2194000 and TradeDate='" + Date + "' and SeoTitle='self' and BrandId=" + BrandId + " group by UserId,QueryCount having sum(HelpDirectTradeAmt)>0 or sum(NotHelpDirectTradeAmt)>0 or sum(ProfitDirectTradeAmt)>0 order by UserId" + LimitString;
                 }
                 }
                 if (BankCardType == 0)
                 if (BankCardType == 0)
                 {
                 {
@@ -464,7 +464,7 @@ namespace MySystem
                                 function.WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + ":贷记卡", "分润监控日志");
                                 function.WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + ":贷记卡", "分润监控日志");
                                 decimal HelpDirectTradeAmt = decimal.Parse(dr[2].ToString()); //贷记卡扶持期交易额
                                 decimal HelpDirectTradeAmt = decimal.Parse(dr[2].ToString()); //贷记卡扶持期交易额
                                 decimal NotHelpDirectTradeAmt = decimal.Parse(dr[3].ToString()); //贷记卡稳定期交易额
                                 decimal NotHelpDirectTradeAmt = decimal.Parse(dr[3].ToString()); //贷记卡稳定期交易额
-                                decimal ProfitHelpDirectTradeAmt = decimal.Parse(dr[4].ToString()); //贷记卡盈利期期交易额
+                                decimal ProfitDirectTradeAmt = decimal.Parse(dr[4].ToString()); //贷记卡盈利期期交易额
                                 int maxLevel = obj.MaxLevel; //最大等级
                                 int maxLevel = obj.MaxLevel; //最大等级
                                 decimal diffLevelProfit = 0;  //等级级差
                                 decimal diffLevelProfit = 0;  //等级级差
                                 int curLevel = 0; //当前层级的会员等级
                                 int curLevel = 0; //当前层级的会员等级
@@ -663,8 +663,8 @@ namespace MySystem
                                             curLevel = UserLevel;
                                             curLevel = UserLevel;
                                         }
                                         }
                                     }
                                     }
-                                    function.WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + ":盈利期:" + ProfitHelpDirectTradeAmt, "分润监控日志");
-                                    if (ProfitHelpDirectTradeAmt > 0)
+                                    function.WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + ":盈利期:" + ProfitDirectTradeAmt, "分润监控日志");
+                                    if (ProfitDirectTradeAmt > 0)
                                     {
                                     {
                                         level = 0;
                                         level = 0;
                                         curLevel = 0;
                                         curLevel = 0;
@@ -696,7 +696,7 @@ namespace MySystem
                                                     decimal getLevelProfit = 0;  //等级分润
                                                     decimal getLevelProfit = 0;  //等级分润
                                                     if (objlevel.Percents > 0)
                                                     if (objlevel.Percents > 0)
                                                     {
                                                     {
-                                                        getLevelProfit += ProfitHelpDirectTradeAmt * objlevel.Percents;
+                                                        getLevelProfit += ProfitDirectTradeAmt * objlevel.Percents;
                                                     }
                                                     }
                                                     if (objlevel.AddProfitVal > 0)
                                                     if (objlevel.AddProfitVal > 0)
                                                     {
                                                     {
@@ -722,7 +722,7 @@ namespace MySystem
                                                             BrandId = BrandId,
                                                             BrandId = BrandId,
                                                             DirectFlag = selfUser.Id == user.Id ? 1 : 0,
                                                             DirectFlag = selfUser.Id == user.Id ? 1 : 0,
                                                             IsSubsidy = 0,
                                                             IsSubsidy = 0,
-                                                            TradeAmount = ProfitHelpDirectTradeAmt,
+                                                            TradeAmount = ProfitDirectTradeAmt,
                                                             HelpFlag = 0,
                                                             HelpFlag = 0,
                                                         });
                                                         });
                                                     }
                                                     }

+ 12 - 11
AppStart/Helper/StatService.cs

@@ -1638,16 +1638,17 @@ namespace MySystem
         {
         {
             while (true)
             while (true)
             {
             {
-                if(DateTime.Now.Day == 1 && DateTime.Now.Hour > 4)
-                {
-                    string Month = DateTime.Now.AddDays(-1).ToString("yyyy-MM");
-                    string flag = function.ReadInstance("/ProfitFlag/" + Month + ".txt");
-                    if (string.IsNullOrEmpty(flag))
-                    {
-                        function.WritePage("/ProfitFlag/", Month + ".txt", DateTime.Now.ToString("HH:mm:ss"));
-                        StatUserLevelStart();
-                    }
-                }
+                // if(DateTime.Now.Day == 1 && DateTime.Now.Hour > 4)
+                // {
+                //     string Month = DateTime.Now.AddDays(-1).ToString("yyyy-MM");
+                //     string flag = function.ReadInstance("/ProfitFlag/" + Month + ".txt");
+                //     if (string.IsNullOrEmpty(flag))
+                //     {
+                //         function.WritePage("/ProfitFlag/", Month + ".txt", DateTime.Now.ToString("HH:mm:ss"));
+                //         StatUserLevelStart();
+                //     }
+                // }
+                ProfitHelperV2.Instance.StatProfit();
                 Thread.Sleep(600000);
                 Thread.Sleep(600000);
             }
             }
         }
         }
@@ -1685,7 +1686,7 @@ namespace MySystem
                                     TradeAmount += db.TradeDaySummary.Where(m => m.UserId == user.Id && m.TradeMonth == TradeMonth && m.SeoTitle == "team").Sum(m => m.HelpNonDirectTradeAmt + m.NotHelpNonDirectTradeAmt);
                                     TradeAmount += db.TradeDaySummary.Where(m => m.UserId == user.Id && m.TradeMonth == TradeMonth && m.SeoTitle == "team").Sum(m => m.HelpNonDirectTradeAmt + m.NotHelpNonDirectTradeAmt);
                                 }
                                 }
                                 //助利宝团队交易额
                                 //助利宝团队交易额
-                                DataTable checkdt = OtherMySqlConn.dtable("SELECT SUM(TradeAmount) TradeAmount FROM HelpProfitMerTradeSummay WHERE (MerchantId IN(SELECT MerchantId FROM HelpProfitMerIds WHERE UserId IN(SELECT Id from Users WHERE ParentNav like '%," + user.Id + ",%' OR Id=" + user.Id + ")) or SeoDescription like '%," + user.Id + ",%' or QueryCount=" + user.Id + ") AND TradeMonth=" + TradeMonth + "");
+                                DataTable checkdt = OtherMySqlConn.dtable("SELECT SUM(TradeAmount) TradeAmount FROM HelpProfitMerTradeSummay WHERE (MerchantId IN(SELECT MerchantId FROM HelpProfitMerIds WHERE UserId IN(SELECT Id from Users WHERE ParentNav like '%," + user.Id + ",%' OR Id=" + user.Id + "))) AND TradeMonth=" + TradeMonth + "");
                                 if (checkdt.Rows.Count > 0)
                                 if (checkdt.Rows.Count > 0)
                                 {
                                 {
                                     TradeAmount += decimal.Parse(function.CheckNum(checkdt.Rows[0]["TradeAmount"].ToString()));
                                     TradeAmount += decimal.Parse(function.CheckNum(checkdt.Rows[0]["TradeAmount"].ToString()));

+ 29 - 29
Startup.cs

@@ -91,8 +91,8 @@ namespace MySystem
             // services.AddHostedService<SycnSpTimer>(); //同步SP数据
             // services.AddHostedService<SycnSpTimer>(); //同步SP数据
 
 
             // services.AddHostedService<TimerStatTimer>(); //实时统计创客、激活商户数
             // services.AddHostedService<TimerStatTimer>(); //实时统计创客、激活商户数
-            services.AddHostedService<PosTradeStatTimer>(); // 统计头天的交易额、商户型创客、激活奖励、开机奖励
-            services.AddHostedService<AlipayPayBack2Timer>(); //支付宝回调处理
+            // services.AddHostedService<PosTradeStatTimer>(); // 统计头天的交易额、商户型创客、激活奖励、开机奖励
+            // services.AddHostedService<AlipayPayBack2Timer>(); //支付宝回调处理
 
 
             //services.AddHttpContextAccessor();
             //services.AddHttpContextAccessor();
 
 
@@ -106,11 +106,11 @@ namespace MySystem
             MySystemLib.SystemPublicFuction.checkurl = checkurl;
             MySystemLib.SystemPublicFuction.checkurl = checkurl;
             MySystemLib.SystemPublicFuction.appcheck = "success";
             MySystemLib.SystemPublicFuction.appcheck = "success";
             Dictionary<string, Dictionary<string, string>> tables = new Dictionary<string, Dictionary<string, string>>();
             Dictionary<string, Dictionary<string, string>> tables = new Dictionary<string, Dictionary<string, string>>();
-            System.Data.DataTable tablecollection = Library.dbconn.dtable("select DISTINCT TABLE_NAME from information_schema.columns where table_schema = 'KxsMainServer'");
+            System.Data.DataTable tablecollection = Library.dbconn.dtable("select DISTINCT TABLE_NAME from information_schema.columns where table_schema = 'KxsMainServer2'");
             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.dbconn.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.dbconn.dtable("select COLUMN_NAME,DATA_TYPE from information_schema.columns where table_schema = 'KxsMainServer2' 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();
@@ -185,33 +185,33 @@ namespace MySystem
             });
             });
 
 
             //必须打开的
             //必须打开的
-            ActiveRewardTimer.Instance.Start(); //实时处理激活记录
-            ChangePosTimer.Instance.Start(); //售后换新执行机具数据转移
-            SycnSpBindService.Instance.Start(); //同步SP绑定数据
-            SycnSpMerchantService.Instance.Start(); //同步SP商户数据
-            SycnSpActiveService.Instance.Start(); //同步SP激活数据
-            SycnSpTradeService.Instance.Start(); //同步SP交易数据
-            SycnSpChangeBindService.Instance.Start(); //同步SP换绑数据
-            SycnSpUnBindService.Instance.Start(); //同步SP解绑数据
-            RedPackageV2Helper.Instance.Start(); //每天生成红包
-            RedPackageV2Helper.Instance.StartStatTop10(); //红包活动统计排行
-            RedPackageV2Helper.Instance.StartSendPrize(); //红包活动发奖
-            BalancePayBackService.Instance.Start(); //余额支付队列
-            ReservePayBackService.Instance.Start(); //储备金支付队列
-            LeaderPrizeService.Instance.Start(); //大盟主奖励发奖
-            MessageCenterService.Instance.Start(); // 消息队列
-            RecommendActStatService.Instance.Start(); //推荐王奖励数据统计
-            StoreApplyHelper.Instance.Start(); // 每月1号重置仓库额度
-            StoreApplyHelper.Instance.StartEverTime();
-            StatService.Instance.StatUserLevel(); //升级并分润
+            // ActiveRewardTimer.Instance.Start(); //实时处理激活记录
+            // ChangePosTimer.Instance.Start(); //售后换新执行机具数据转移
+            // SycnSpBindService.Instance.Start(); //同步SP绑定数据
+            // SycnSpMerchantService.Instance.Start(); //同步SP商户数据
+            // SycnSpActiveService.Instance.Start(); //同步SP激活数据
+            // SycnSpTradeService.Instance.Start(); //同步SP交易数据
+            // SycnSpChangeBindService.Instance.Start(); //同步SP换绑数据
+            // SycnSpUnBindService.Instance.Start(); //同步SP解绑数据
+            // RedPackageV2Helper.Instance.Start(); //每天生成红包
+            // RedPackageV2Helper.Instance.StartStatTop10(); //红包活动统计排行
+            // RedPackageV2Helper.Instance.StartSendPrize(); //红包活动发奖
+            // BalancePayBackService.Instance.Start(); //余额支付队列
+            // ReservePayBackService.Instance.Start(); //储备金支付队列
+            // LeaderPrizeService.Instance.Start(); //大盟主奖励发奖
+            // MessageCenterService.Instance.Start(); // 消息队列
+            // RecommendActStatService.Instance.Start(); //推荐王奖励数据统计
+            // StoreApplyHelper.Instance.Start(); // 每月1号重置仓库额度
+            // StoreApplyHelper.Instance.StartEverTime();
+            // StatService.Instance.StatUserLevel(); //升级并分润
             //必须打开的
             //必须打开的
 
 
-            HelpProfitHelper.Instance.Start();
-            HelpProfitPreMerchantHelper.Instance.Start();
-            SetDepositService.Instance.Start(); //调整费率(通知、标记)
-            SetDepositPostService.Instance.Start(); //提交支付公司设置费率接口
-            SetDepositPostService.Instance.StartKdb(); //监控开店宝费率设置结果
-            SetFeeFlagService.Instance.Start(); //178天提前通知创客费率调升消息
+            // HelpProfitHelper.Instance.Start();
+            // HelpProfitPreMerchantHelper.Instance.Start();
+            // SetDepositService.Instance.Start(); //调整费率(通知、标记)
+            // SetDepositPostService.Instance.Start(); //提交支付公司设置费率接口
+            // SetDepositPostService.Instance.StartKdb(); //监控开店宝费率设置结果
+            // SetFeeFlagService.Instance.Start(); //178天提前通知创客费率调升消息
 
 
             // StatService.Instance.StartPosActNum(); //实时统计激活数
             // StatService.Instance.StartPosActNum(); //实时统计激活数
             // StatService.Instance.StartNewUserNum(); //实时统计新增创客数
             // StatService.Instance.StartNewUserNum(); //实时统计新增创客数

+ 2 - 2
appsettings.json

@@ -17,8 +17,8 @@
     "Host": "http://localhost:5047/",
     "Host": "http://localhost:5047/",
     "SourceHost": "http://bs.kexiaoshuang.com/",
     "SourceHost": "http://bs.kexiaoshuang.com/",
     "Database": "KxsMainServer",
     "Database": "KxsMainServer",
-    "SqlConnStr": "server=47.108.231.170;port=3306;user=KxsMain;password=mzeqjriUWore0dwT;database=KxsMainServer;charset=utf8;",
-    "Pxc1SqlConnStr": "server=47.108.231.170;port=3306;user=KxsMain;password=mzeqjriUWore0dwT;database=KxsMainServer;charset=utf8;",
+    "SqlConnStr": "server=47.109.31.237;port=3306;user=KxsMainServer2;password=FrW8ZfxlcaVdm1r0;database=KxsMainServer2;charset=utf8;",
+    "Pxc1SqlConnStr": "server=47.109.31.237;port=3306;user=KxsMainServer2;password=FrW8ZfxlcaVdm1r0;database=KxsMainServer2;charset=utf8;",
     "SpSqlConnStr": "server=47.109.31.237;port=3306;user=KxsSpServer;password=jJ9qKsvwWgQA9xWG;database=KxsSpServer;charset=utf8;",
     "SpSqlConnStr": "server=47.109.31.237;port=3306;user=KxsSpServer;password=jJ9qKsvwWgQA9xWG;database=KxsSpServer;charset=utf8;",
     "RedisConnStr": "47.109.31.237:6379,password=klm@redis,DefaultDatabase=1,poolsize=500,preheat=50,asyncPipeline=true",
     "RedisConnStr": "47.109.31.237:6379,password=klm@redis,DefaultDatabase=1,poolsize=500,preheat=50,asyncPipeline=true",
     "IOSAppVersion": "1.0.0",
     "IOSAppVersion": "1.0.0",