lcl 6 месяцев назад
Родитель
Сommit
8b7fb94de2
3 измененных файлов с 20 добавлено и 16 удалено
  1. 8 8
      Startup.cs
  2. 7 5
      Util/HaoDa/ProfitAfterNewHelper.cs
  3. 5 3
      Util/HaoDa/ProfitBeforeNewHelper.cs

+ 8 - 8
Startup.cs

@@ -166,14 +166,14 @@ namespace MySystem
                 ProfitHelper.Instance.StartListenTrade(); //返现队列-支付宝
                 ProfitHelper.Instance.StartListenWxTrade(); //返现队列-微信
                 ProfitHelper.Instance.StartSetDivi(); //设置订单当前返现金额
-                ProfitBeforeHelper.Instance.StartListenProfit(); //每月分润
-                ProfitAfterHelper.Instance.StartListenProfit(); //每月分润
-                ProfitBeforeNewHelper.Instance.StartListenProfit(); //每月分润
-                ProfitAfterNewHelper.Instance.StartListenProfit(); //每月分润
-                ProfitBeforeHelper.Instance.StartListenProfitAdd(); //补每月分润
-                ProfitAfterHelper.Instance.StartListenProfitAdd(); //补每月分润
-                ProfitBeforeNewHelper.Instance.StartListenProfitAdd(); //补每月分润
-                ProfitAfterNewHelper.Instance.StartListenProfitAdd(); //补每月分润
+                // ProfitBeforeHelper.Instance.StartListenProfit(); //每月分润
+                // ProfitAfterHelper.Instance.StartListenProfit(); //每月分润
+                // ProfitBeforeNewHelper.Instance.StartListenProfit(); //每月分润
+                // ProfitAfterNewHelper.Instance.StartListenProfit(); //每月分润
+                // ProfitBeforeHelper.Instance.StartListenProfitAdd(); //补每月分润
+                // ProfitAfterHelper.Instance.StartListenProfitAdd(); //补每月分润
+                // ProfitBeforeNewHelper.Instance.StartListenProfitAdd(); //补每月分润
+                // ProfitAfterNewHelper.Instance.StartListenProfitAdd(); //补每月分润
                 ProfitCheckHelper.Instance.Start(); //检查订单是否在队列里
                 SettleAmountCheckHelper.Instance.Start(); //检查未结算分账订单队列
 

+ 7 - 5
Util/HaoDa/ProfitAfterNewHelper.cs

@@ -101,13 +101,14 @@ namespace MySystem
             Models.KxsMain.WebCMSEntities kxsdb = new Models.KxsMain.WebCMSEntities();
             WebCMSEntities dbnew = new WebCMSEntities();
             KxsUserModels.WebCMSEntities udb = new KxsUserModels.WebCMSEntities();
-            DataTable dt = CustomerSqlConn.dtable("select IsAct,UserId,sum(TotalAmount),Sort from UserAmountSummaryNewAfter where TradeMonth='" + TradeMonth + "'" + otherCondi + " and SeoTitle='self' group by IsAct,UserId,Sort", AppConfig.Base.SqlConnStr);
+            DataTable dt = CustomerSqlConn.dtable("select IsAct,UserId,sum(TotalAmount),Sort,QueryCount from UserAmountSummaryNewAfter where TradeMonth='" + TradeMonth + "'" + otherCondi + " and SeoTitle='self' group by IsAct,UserId,Sort,QueryCount", AppConfig.Base.SqlConnStr);
             foreach (DataRow dr in dt.Rows)
             {
                 int UserId = int.Parse(dr["UserId"].ToString());
                 bool IsActive = dr["IsAct"].ToString() == "1";
                 int Sort = int.Parse(dr["Sort"].ToString());
-                decimal TotalAmount = decimal.Parse(dr[2].ToString());
+                decimal TotalAmount = decimal.Parse(dr[2].ToString());                
+                bool WenDing = dr["QueryCount"].ToString() == "1";
                 List<ProfitUsers> users = new List<ProfitUsers>();
                 int TopUserId = 0; //顶级创客Id
                 KxsUserModels.KxsUser us = udb.KxsUser.FirstOrDefault(a => a.Id == UserId);
@@ -150,7 +151,7 @@ namespace MySystem
                 KxsUserModels.KxsUser topUser = udb.KxsUser.FirstOrDefault(a => a.Id == TopUserId) ?? new KxsUserModels.KxsUser();
                 LogHelper.Instance.WriteLog("---UserId:" + UserId + ";TotalAmount:" + TotalAmount + ";", "来客吧分润日志");
                 List<ProfitResult> list = new List<ProfitResult>();
-                list = StartProft(TradeMonth, TotalAmount, 1, users, Sort, IsActive);
+                list = StartProft(TradeMonth, TotalAmount, 1, users, Sort, WenDing, IsActive);
                 LogHelper.Instance.WriteLog("---list:" + list.Count + ";", "来客吧分润日志");
                 try
                 {
@@ -215,7 +216,7 @@ namespace MySystem
         #endregion
 
         #region 分润算法
-        public List<ProfitResult> StartProft(string Month, decimal TotalAmount, int LevelKindId, List<ProfitUsers> users, int Sort, bool IsActive = true)
+        public List<ProfitResult> StartProft(string Month, decimal TotalAmount, int LevelKindId, List<ProfitUsers> users, int Sort, bool WenDing, bool IsActive = true)
         {
             LogHelper.Instance.WriteLog("\n\nTotalAmount:" + TotalAmount + ";", "来客吧分润日志");
             WebCMSEntities db = new WebCMSEntities();
@@ -278,7 +279,8 @@ namespace MySystem
                             if (objlevel != null)
                             {
                                 decimal getLevelProfit = 0;  //等级分润
-                                UserProfitSet profitSet = new UserProfitSet();
+                                UserProfitSet profitSet = new UserProfitSet();                                
+                                if(WenDing) objlevel.Percents = objlevel.Percents * 0.8M;
                                 decimal profitPercent = IsActive ? objlevel.DebitPercents : objlevel.Percents;
                                 LogHelper.Instance.WriteLog("money:" + UserLevel + ":" + profitPercent + ";", "来客吧分润日志");
                                 if (profitPercent > 0)

+ 5 - 3
Util/HaoDa/ProfitBeforeNewHelper.cs

@@ -101,13 +101,14 @@ namespace MySystem
             Models.KxsMain.WebCMSEntities kxsdb = new Models.KxsMain.WebCMSEntities();
             WebCMSEntities dbnew = new WebCMSEntities();
             KxsUserModels.WebCMSEntities udb = new KxsUserModels.WebCMSEntities();
-            DataTable dt = CustomerSqlConn.dtable("select IsAct,UserId,sum(TotalAmount),Sort from UserAmountSummaryNewBefore where TradeMonth='" + TradeMonth + "'" + otherCondi + " and SeoTitle='self' group by IsAct,UserId,Sort", AppConfig.Base.SqlConnStr);
+            DataTable dt = CustomerSqlConn.dtable("select IsAct,UserId,sum(TotalAmount),Sort,QueryCount from UserAmountSummaryNewBefore where TradeMonth='" + TradeMonth + "'" + otherCondi + " and SeoTitle='self' group by IsAct,UserId,Sort,QueryCount", AppConfig.Base.SqlConnStr);
             foreach (DataRow dr in dt.Rows)
             {
                 int UserId = int.Parse(dr["UserId"].ToString());
                 bool IsActive = dr["IsAct"].ToString() == "1";
                 int Sort = int.Parse(dr["Sort"].ToString());
                 decimal TotalAmount = decimal.Parse(dr[2].ToString());
+                bool WenDing = dr["QueryCount"].ToString() == "1";
                 List<ProfitUsers> users = new List<ProfitUsers>();
                 int TopUserId = 0; //顶级创客Id
                 KxsUserModels.KxsUser us = udb.KxsUser.FirstOrDefault(a => a.Id == UserId);
@@ -150,7 +151,7 @@ namespace MySystem
                 KxsUserModels.KxsUser topUser = udb.KxsUser.FirstOrDefault(a => a.Id == TopUserId) ?? new KxsUserModels.KxsUser();
                 LogHelper.Instance.WriteLog("---UserId:" + UserId + ";TotalAmount:" + TotalAmount + ";", "来客吧分润日志");
                 List<ProfitResult> list = new List<ProfitResult>();
-                list = StartProft(TradeMonth, TotalAmount, 1, users, Sort, IsActive);
+                list = StartProft(TradeMonth, TotalAmount, 1, users, Sort, WenDing, IsActive);
                 LogHelper.Instance.WriteLog("---list:" + list.Count + ";", "来客吧分润日志");
                 try
                 {
@@ -216,7 +217,7 @@ namespace MySystem
         #endregion
 
         #region 分润算法
-        public List<ProfitResult> StartProft(string Month, decimal TotalAmount, int LevelKindId, List<ProfitUsers> users, int Sort, bool IsActive = true)
+        public List<ProfitResult> StartProft(string Month, decimal TotalAmount, int LevelKindId, List<ProfitUsers> users, int Sort, bool WenDing, bool IsActive = true)
         {
             LogHelper.Instance.WriteLog("\n\nTotalAmount:" + TotalAmount + ";", "来客吧分润日志");
             WebCMSEntities db = new WebCMSEntities();
@@ -280,6 +281,7 @@ namespace MySystem
                             {
                                 decimal getLevelProfit = 0;  //等级分润
                                 UserProfitSet profitSet = new UserProfitSet();
+                                if(WenDing) objlevel.Percents = objlevel.Percents * 0.8M;
                                 decimal profitPercent = IsActive ? objlevel.DebitPercents : objlevel.Percents;
                                 LogHelper.Instance.WriteLog("money:" + UserLevel + ":" + profitPercent + ";", "来客吧分润日志");
                                 if (profitPercent > 0)