Browse Source

分润分费率

lcl 1 tháng trước cách đây
mục cha
commit
a59b1a8895
2 tập tin đã thay đổi với 144 bổ sung100 xóa
  1. 72 50
      Util/HaoDa/ProfitAfterHelper.cs
  2. 72 50
      Util/HaoDa/ProfitBeforeHelper.cs

+ 72 - 50
Util/HaoDa/ProfitAfterHelper.cs

@@ -196,64 +196,86 @@ namespace MySystem
                 maxLevelProfit = PublicFunction.NumberFormat(maxLevelProfit);
                 LogHelper.Instance.WriteLog("maxLevelProfit:" + maxLevelProfit + ";", "来客吧分润日志");
                 // decimal diffDiviProfit = 0; //分红级差
-                int curLevel = 0; //当前层级的会员等级
-                for (int curFloor = 1; curFloor <= users.Count; curFloor++)
+                
+                //0.38分万15  0.25分万2  0.3分万7,成本0.23
+                if(Sort == 30 || Sort == 25)
                 {
-                    ProfitUsers user = new ProfitUsers();
-                    if (curFloor <= users.Count)
+                    decimal profit = 0;
+                    if(Sort == 25) profit = TotalAmount * 0.0002M;
+                    if(Sort == 30) profit = TotalAmount * 0.0007M;
+                    ProfitUsers user = users[0];
+                    result.Add(new ProfitResult()
                     {
-                        user = users[curFloor - 1];
-                    }
-                    SubUser selfUser = GetUser(user.UserId, Month) ?? new SubUser();
-                    int UserLevel = GetUserLevel(selfUser); //当前会员等级
-                    //判断当前创客是否有直推的激活机具,并且在活动时间内
-                    if (curLevel == maxLevel)
-                    {
-                        break;
-                    }
-                    if (UserLevel <= maxLevel && UserLevel >= curLevel)
+                        UserId = user.UserId,
+                        MakerCode = user.MakerCode,
+                        RealName = user.RealName,
+                        UserNav = user.UserNav,
+                        Money = PublicFunction.NumberFormat(profit),
+                        ProfitRate = Sort / 10000,
+                        Fee = Sort,
+                    });
+                }
+                else
+                {
+                    int curLevel = 0; //当前层级的会员等级
+                    for (int curFloor = 1; curFloor <= users.Count; curFloor++)
                     {
-                        ProfitObjectLevels objlevel = db.ProfitObjectLevels.FirstOrDefault(m => m.Id == UserLevel && m.Sort == Sort); //获取当前等级参数
-                        if (objlevel != null)
+                        ProfitUsers user = new ProfitUsers();
+                        if (curFloor <= users.Count)
                         {
-                            decimal getLevelProfit = 0;  //等级分润
-                            UserProfitSet profitSet = new UserProfitSet();
-                            decimal profitPercent = IsActive ? objlevel.DebitPercents : objlevel.Percents;
-                            LogHelper.Instance.WriteLog("money:" + UserLevel + ":" + profitPercent + ";", "来客吧分润日志");
-                            if (profitPercent > 0)
-                            {
-                                decimal profitTmp = TotalAmount * profitPercent;
-                                getLevelProfit += profitTmp;
-                                LogHelper.Instance.WriteLog("money:" + UserLevel + ":" + profitTmp + ";", "来客吧分润日志");
-                            }
-                            decimal money = getLevelProfit;
-                            getLevelProfit -= diffLevelProfit;
-                            if (objlevel.LevelDiff == 1)  //判断是否有级差
-                            {
-                                diffLevelProfit = money;
-                            }
-                            if (getLevelProfit >= obj.MinProfitVal)
+                            user = users[curFloor - 1];
+                        }
+                        SubUser selfUser = GetUser(user.UserId, Month) ?? new SubUser();
+                        int UserLevel = GetUserLevel(selfUser); //当前会员等级
+                        //判断当前创客是否有直推的激活机具,并且在活动时间内
+                        if (curLevel == maxLevel)
+                        {
+                            break;
+                        }
+                        if (UserLevel <= maxLevel && UserLevel >= curLevel)
+                        {
+                            ProfitObjectLevels objlevel = db.ProfitObjectLevels.FirstOrDefault(m => m.Id == UserLevel); //获取当前等级参数
+                            if (objlevel != null)
                             {
-                                result.Add(new ProfitResult()
+                                decimal getLevelProfit = 0;  //等级分润
+                                UserProfitSet profitSet = new UserProfitSet();
+                                decimal profitPercent = IsActive ? objlevel.DebitPercents : objlevel.Percents;
+                                LogHelper.Instance.WriteLog("money:" + UserLevel + ":" + profitPercent + ";", "来客吧分润日志");
+                                if (profitPercent > 0)
+                                {
+                                    decimal profitTmp = TotalAmount * profitPercent;
+                                    getLevelProfit += profitTmp;
+                                    LogHelper.Instance.WriteLog("money:" + UserLevel + ":" + profitTmp + ";", "来客吧分润日志");
+                                }
+                                decimal money = getLevelProfit;
+                                getLevelProfit -= diffLevelProfit;
+                                if (objlevel.LevelDiff == 1)  //判断是否有级差
                                 {
-                                    UserId = user.UserId,
-                                    MakerCode = user.MakerCode,
-                                    RealName = user.RealName,
-                                    UserNav = user.UserNav,
-                                    Money = PublicFunction.NumberFormat(getLevelProfit),
-                                    ProfitRate = profitSet.ProfitRate,
-                                    ProfitPercent = profitSet.ProfitPercent,
-                                    AddOrSubRate = profitSet.AddOrSubRate,
-                                    ProfitRateBase = profitSet.ProfitRateBase,
-                                    Fee = Sort,
-                                });
-                                LogHelper.Instance.WriteLog("money:" + UserLevel + ":" + PublicFunction.NumberFormat(getLevelProfit) + ";", "来客吧分润日志");
+                                    diffLevelProfit = money;
+                                }
+                                if (getLevelProfit >= obj.MinProfitVal)
+                                {
+                                    result.Add(new ProfitResult()
+                                    {
+                                        UserId = user.UserId,
+                                        MakerCode = user.MakerCode,
+                                        RealName = user.RealName,
+                                        UserNav = user.UserNav,
+                                        Money = PublicFunction.NumberFormat(getLevelProfit),
+                                        ProfitRate = profitSet.ProfitRate,
+                                        ProfitPercent = profitSet.ProfitPercent,
+                                        AddOrSubRate = profitSet.AddOrSubRate,
+                                        ProfitRateBase = profitSet.ProfitRateBase,
+                                        Fee = Sort,
+                                    });
+                                    LogHelper.Instance.WriteLog("money:" + UserLevel + ":" + PublicFunction.NumberFormat(getLevelProfit) + ";", "来客吧分润日志");
+                                }
                             }
                         }
-                    }
-                    if (curLevel < UserLevel)
-                    {
-                        curLevel = UserLevel;
+                        if (curLevel < UserLevel)
+                        {
+                            curLevel = UserLevel;
+                        }
                     }
                 }
             }

+ 72 - 50
Util/HaoDa/ProfitBeforeHelper.cs

@@ -200,64 +200,86 @@ namespace MySystem
                 maxLevelProfit = PublicFunction.NumberFormat(maxLevelProfit);
                 LogHelper.Instance.WriteLog("maxLevelProfit:" + maxLevelProfit + ";", "来客吧分润日志");
                 // decimal diffDiviProfit = 0; //分红级差
-                int curLevel = 0; //当前层级的会员等级
-                for (int curFloor = 1; curFloor <= users.Count; curFloor++)
+
+                //0.38分万15  0.25分万2  0.3分万7,成本0.23
+                if(Sort == 30 || Sort == 25)
                 {
-                    ProfitUsers user = new ProfitUsers();
-                    if (curFloor <= users.Count)
-                    {
-                        user = users[curFloor - 1];
-                    }
-                    SubUser selfUser = GetUser(user.UserId, Month) ?? new SubUser();
-                    int UserLevel = GetUserLevel(selfUser); //当前会员等级
-                    //判断当前创客是否有直推的激活机具,并且在活动时间内
-                    if (curLevel == maxLevel)
+                    decimal profit = 0;
+                    if(Sort == 25) profit = TotalAmount * 0.0002M;
+                    if(Sort == 30) profit = TotalAmount * 0.0007M;
+                    ProfitUsers user = users[0];
+                    result.Add(new ProfitResult()
                     {
-                        break;
-                    }
-                    if (UserLevel <= maxLevel && UserLevel >= curLevel)
+                        UserId = user.UserId,
+                        MakerCode = user.MakerCode,
+                        RealName = user.RealName,
+                        UserNav = user.UserNav,
+                        Money = PublicFunction.NumberFormat(profit),
+                        ProfitRate = Sort / 10000,
+                        Fee = Sort,
+                    });
+                }
+                else
+                {
+                    int curLevel = 0; //当前层级的会员等级
+                    for (int curFloor = 1; curFloor <= users.Count; curFloor++)
                     {
-                        ProfitObjectLevels objlevel = db.ProfitObjectLevels.FirstOrDefault(m => m.Id == UserLevel && m.Sort == Sort); //获取当前等级参数
-                        if (objlevel != null)
+                        ProfitUsers user = new ProfitUsers();
+                        if (curFloor <= users.Count)
                         {
-                            decimal getLevelProfit = 0;  //等级分润
-                            UserProfitSet profitSet = new UserProfitSet();
-                            decimal profitPercent = IsActive ? objlevel.DebitPercents : objlevel.Percents;
-                            LogHelper.Instance.WriteLog("money:" + UserLevel + ":" + profitPercent + ";", "来客吧分润日志");
-                            if (profitPercent > 0)
-                            {
-                                decimal profitTmp = TotalAmount * profitPercent;
-                                getLevelProfit += profitTmp;
-                                LogHelper.Instance.WriteLog("money:" + UserLevel + ":" + profitTmp + ";", "来客吧分润日志");
-                            }
-                            decimal money = getLevelProfit;
-                            getLevelProfit -= diffLevelProfit;
-                            if (objlevel.LevelDiff == 1)  //判断是否有级差
-                            {
-                                diffLevelProfit = money;
-                            }
-                            if (getLevelProfit >= obj.MinProfitVal)
+                            user = users[curFloor - 1];
+                        }
+                        SubUser selfUser = GetUser(user.UserId, Month) ?? new SubUser();
+                        int UserLevel = GetUserLevel(selfUser); //当前会员等级
+                        //判断当前创客是否有直推的激活机具,并且在活动时间内
+                        if (curLevel == maxLevel)
+                        {
+                            break;
+                        }
+                        if (UserLevel <= maxLevel && UserLevel >= curLevel)
+                        {
+                            ProfitObjectLevels objlevel = db.ProfitObjectLevels.FirstOrDefault(m => m.Id == UserLevel && m.Sort == Sort); //获取当前等级参数
+                            if (objlevel != null)
                             {
-                                result.Add(new ProfitResult()
+                                decimal getLevelProfit = 0;  //等级分润
+                                UserProfitSet profitSet = new UserProfitSet();
+                                decimal profitPercent = IsActive ? objlevel.DebitPercents : objlevel.Percents;
+                                LogHelper.Instance.WriteLog("money:" + UserLevel + ":" + profitPercent + ";", "来客吧分润日志");
+                                if (profitPercent > 0)
+                                {
+                                    decimal profitTmp = TotalAmount * profitPercent;
+                                    getLevelProfit += profitTmp;
+                                    LogHelper.Instance.WriteLog("money:" + UserLevel + ":" + profitTmp + ";", "来客吧分润日志");
+                                }
+                                decimal money = getLevelProfit;
+                                getLevelProfit -= diffLevelProfit;
+                                if (objlevel.LevelDiff == 1)  //判断是否有级差
                                 {
-                                    UserId = user.UserId,
-                                    MakerCode = user.MakerCode,
-                                    RealName = user.RealName,
-                                    UserNav = user.UserNav,
-                                    Money = PublicFunction.NumberFormat(getLevelProfit),
-                                    ProfitRate = profitSet.ProfitRate,
-                                    ProfitPercent = profitSet.ProfitPercent,
-                                    AddOrSubRate = profitSet.AddOrSubRate,
-                                    ProfitRateBase = profitSet.ProfitRateBase,
-                                    Fee = Sort,
-                                });
-                                LogHelper.Instance.WriteLog("money:" + UserLevel + ":" + PublicFunction.NumberFormat(getLevelProfit) + ";", "来客吧分润日志");
+                                    diffLevelProfit = money;
+                                }
+                                if (getLevelProfit >= obj.MinProfitVal)
+                                {
+                                    result.Add(new ProfitResult()
+                                    {
+                                        UserId = user.UserId,
+                                        MakerCode = user.MakerCode,
+                                        RealName = user.RealName,
+                                        UserNav = user.UserNav,
+                                        Money = PublicFunction.NumberFormat(getLevelProfit),
+                                        ProfitRate = profitSet.ProfitRate,
+                                        ProfitPercent = profitSet.ProfitPercent,
+                                        AddOrSubRate = profitSet.AddOrSubRate,
+                                        ProfitRateBase = profitSet.ProfitRateBase,
+                                        Fee = Sort,
+                                    });
+                                    LogHelper.Instance.WriteLog("money:" + UserLevel + ":" + PublicFunction.NumberFormat(getLevelProfit) + ";", "来客吧分润日志");
+                                }
                             }
                         }
-                    }
-                    if (curLevel < UserLevel)
-                    {
-                        curLevel = UserLevel;
+                        if (curLevel < UserLevel)
+                        {
+                            curLevel = UserLevel;
+                        }
                     }
                 }
             }