Selaa lähdekoodia

修改补贴计算逻辑

lichunlei 3 vuotta sitten
vanhempi
commit
7d77ada9c1
3 muutettua tiedostoa jossa 58 lisäystä ja 28 poistoa
  1. 49 19
      AppStart/Helper/Profit/ProfitHelper.cs
  2. 4 4
      AppStart/Helper/StatService.cs
  3. 5 5
      Startup.cs

+ 49 - 19
AppStart/Helper/Profit/ProfitHelper.cs

@@ -2199,6 +2199,12 @@ namespace MySystem
                                                 UserLevel = rank.Rank;
                                             }
                                         }
+                                        if(level == 1)
+                                        {
+                                            function.WriteLog(user.MakerCode, "分润补贴日志");
+                                            function.WriteLog(user.UserLevel.ToString(), "分润补贴日志");
+                                            function.WriteLog(pos.PosSn, "分润补贴日志");
+                                        }
                                         if (UserLevel == maxLevel && UserLevel == curLevel) //判断当前创客是否有直推的激活机具,并且在活动时间内
                                         {
                                             break;
@@ -2210,6 +2216,7 @@ namespace MySystem
                                             {
                                                 HelpTime = 1;
                                             }
+                                            function.WriteLog("HelpTime:" + HelpTime, "分润补贴日志");
                                             int LevelKindId = GetLevelKindId(BrandId, HelpTime, 1);
                                             ProfitObjectLevels objlevel = RedisDbconn.Instance.Get<ProfitObjectLevels>("pobjlv" + LevelKindId + ":" + UserLevel); //获取当前等级参数
                                             if (objlevel != null)
@@ -2254,29 +2261,52 @@ namespace MySystem
                                                 //分润补贴
                                                 if (HelpTime == 1 && level == 1)
                                                 {
+                                                    function.WriteLog("满足条件", "分润补贴日志");
                                                     int SubsidyUserId = pos.BuyUserId;
                                                     Users subuser = dbnew.Users.FirstOrDefault(m => m.Id == SubsidyUserId) ?? new Users();
-                                                    decimal otherPercent = 0.001M - objlevel.Percents;
-                                                    decimal otherMoney = TradeAmt * otherPercent;
-                                                    if (otherMoney >= obj.MinProfitVal)
+                                                    int subUserLevel = subuser.UserLevel;
+                                                    if(subUserLevel < 5)
                                                     {
-                                                        result.Add(new ProfitResult()
+                                                        function.WriteLog("1:" + subUserLevel, "分润补贴日志");
+                                                        UserRankWhite subrank = dbnew.UserRankWhite.FirstOrDefault(m => m.Id == subuser.Id && m.UpdateDate > now);
+                                                        if (subrank != null)
+                                                        {
+                                                            if (subrank.Rank > subUserLevel)
+                                                            {
+                                                                subUserLevel = subrank.Rank;
+                                                            }
+                                                        }
+                                                        if(subUserLevel < 5)
                                                         {
-                                                            UserId = subuser.Id,
-                                                            UserNav = subuser.ParentNav,
-                                                            Money = PublicFunction.NumberFormat(otherMoney),
-                                                            ProfitRate = otherPercent,
-                                                            Message = "分润补贴",
-                                                            BankCardType = BankCardType,
-                                                            QrPayFlag = QrPayFlag,
-                                                            DirectFlag = 1,
-                                                            BrandId = pos.BrandId,
-                                                            IsSubsidy = 1,
-                                                            MerchantId = pos.BindMerchantId,
-                                                            TradeAmount = TradeAmt,
-                                                            HelpFlag = HelpTime,
-                                                            PosSn = pos.PosSn,
-                                                        });
+                                                            function.WriteLog("2:" + subUserLevel, "分润补贴日志");
+                                                            ProfitObjectLevels sublevel = RedisDbconn.Instance.Get<ProfitObjectLevels>("pobjlv" + LevelKindId + ":" + subUserLevel); //获取当前等级参数
+                                                            if (sublevel != null)
+                                                            {
+                                                                function.WriteLog("3:" + sublevel.Percents, "分润补贴日志");
+                                                                decimal otherPercent = 0.001M - sublevel.Percents;
+                                                                decimal otherMoney = TradeAmt * otherPercent;
+                                                                if (otherMoney >= obj.MinProfitVal)
+                                                                {
+                                                                    result.Add(new ProfitResult()
+                                                                    {
+                                                                        UserId = subuser.Id,
+                                                                        UserNav = subuser.ParentNav,
+                                                                        Money = PublicFunction.NumberFormat(otherMoney),
+                                                                        ProfitRate = otherPercent,
+                                                                        Message = "分润补贴",
+                                                                        BankCardType = BankCardType,
+                                                                        QrPayFlag = QrPayFlag,
+                                                                        DirectFlag = 1,
+                                                                        BrandId = pos.BrandId,
+                                                                        IsSubsidy = 1,
+                                                                        MerchantId = pos.BindMerchantId,
+                                                                        TradeAmount = TradeAmt,
+                                                                        HelpFlag = HelpTime,
+                                                                        PosSn = pos.PosSn,
+                                                                    });
+                                                                }
+                                                            }
+                                                        }
                                                     }
                                                 }
                                             }

+ 4 - 4
AppStart/Helper/StatService.cs

@@ -1181,8 +1181,8 @@ namespace MySystem
         }
         public void StartEverDayDo()
         {
-            DateTime end = DateTime.Parse("2022-06-06 00:00:00");
-            DateTime check = DateTime.Parse("2022-04-30");
+            DateTime end = DateTime.Parse("2022-05-31 00:00:00");
+            DateTime check = DateTime.Parse("2022-03-11");
             while (check <= end)
             {
                 StatTradeAmountEverDay(check.ToString("yyyy-MM-dd"));
@@ -1751,7 +1751,7 @@ namespace MySystem
         }
         public void StartPosActNumFor()
         {
-            DateTime end = DateTime.Parse("2022-06-06 00:00:00");
+            DateTime end = DateTime.Parse("2022-05-31 00:00:00");
             DateTime check = DateTime.Parse("2022-05-27");
             while (check <= end)
             {
@@ -1862,7 +1862,7 @@ namespace MySystem
         }
         public void StartNewUserNumFor()
         {
-            DateTime end = DateTime.Parse("2022-06-06 00:00:00");
+            DateTime end = DateTime.Parse("2022-05-31 00:00:00");
             DateTime check = DateTime.Parse("2022-05-27");
             while (check <= end)
             {

+ 5 - 5
Startup.cs

@@ -229,12 +229,12 @@ namespace MySystem
             // SycnSpTradeService.Instance.Start(); //同步SP交易数据
             //必须打开的
 
-            StatService.Instance.StartPosActNum(); //实时统计激活数
-            StatService.Instance.StartNewUserNum(); //实时统计新增创客数
-            StatService.Instance.StartEverDay("");
-            StatService.Instance.StatProfit("");
+            // StatService.Instance.StartPosActNum(); //实时统计激活数
+            // StatService.Instance.StartNewUserNum(); //实时统计新增创客数
+            // StatService.Instance.StartEverDay("");
+            // StatService.Instance.StatProfit("");
             // StatService.Instance.StatUserLevel();
-            // ProfitHelper.Instance.StatProfit("202205"); //统计分润
+            ProfitHelper.Instance.StatProfit("202205"); //统计分润
             // StatService.Instance.ListenFluxRecord();
             // StatService.Instance.StartEverDay2();
             // TestHelper.Instance.Start();