Эх сурвалжийг харах

小分仓额度重置调整,在分润结束后执行

lichunlei 2 жил өмнө
parent
commit
0b83c14c4e

+ 1 - 0
AppStart/Helper/Profit/ProfitHelperV2.cs

@@ -43,6 +43,7 @@ namespace MySystem
                 check = check.AddDays(1);
                 check = check.AddDays(1);
             }
             }
 
 
+            RedisDbconn.Instance.AddList("ResetSmallStoreQueue", "1");
             ProfitHelper.Instance.StatProfit();
             ProfitHelper.Instance.StatProfit();
         }
         }
         public void StatProfitEveryDay(object sender)
         public void StatProfitEveryDay(object sender)

+ 11 - 4
AppStart/Timer/ResetSmallStoreHelper.cs

@@ -32,14 +32,21 @@ public class ResetSmallStoreHelper
             OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["Pxc1SqlConnStr"].ToString();
             OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["Pxc1SqlConnStr"].ToString();
             try
             try
             {
             {
-                // if(DateTime.Now.Day == 1 && DateTime.Now.Hour > 0 && DateTime.Now.Hour < 3)
-                // {
+                string content = RedisDbconn.Instance.RPop<string>("ResetSmallStoreQueue");
+                if(!string.IsNullOrEmpty(content))
+                {
                     string Month = DateTime.Now.AddMonths(-1).ToString("yyyyMM");
                     string Month = DateTime.Now.AddMonths(-1).ToString("yyyyMM");
                     string check = function.ReadInstance("/ResetSmallStore/" + Month + ".txt");
                     string check = function.ReadInstance("/ResetSmallStore/" + Month + ".txt");
                     if(string.IsNullOrEmpty(check))
                     if(string.IsNullOrEmpty(check))
                     {
                     {
                         function.WritePage("/ResetSmallStore/", Month + ".txt", DateTime.Now.ToString());
                         function.WritePage("/ResetSmallStore/", Month + ".txt", DateTime.Now.ToString());
-                        DataTable dt = OtherMySqlConn.dtable("select UserId,sum(CreditTradeProfit+DebitNonTradeCapProfit+DebitTradeCapProfit) from ProfitRewardRecord where UserId>0 and TradeMonth='" + Month + "' group by UserId order by UserId");
+                        string minId = "0";
+                        DataTable minIdDt = OtherMySqlConn.dtable("select min(Id) from ProfitRewardRecord where TradeMonth='" + Month + "'");
+                        if(minIdDt.Rows.Count > 0)
+                        {
+                            minId = minIdDt.Rows[0][0].ToString();
+                        }
+                        DataTable dt = OtherMySqlConn.dtable("select UserId,sum(CreditTradeProfit+DebitNonTradeCapProfit+DebitTradeCapProfit) from ProfitRewardRecord where Id>=" + minId + " and UserId>0 and TradeMonth='" + Month + "' group by UserId");
                         function.WriteLog("总数" + dt.Rows.Count, "计算小分仓额度日志");
                         function.WriteLog("总数" + dt.Rows.Count, "计算小分仓额度日志");
                         int index = 0;
                         int index = 0;
                         foreach(DataRow dr in dt.Rows)
                         foreach(DataRow dr in dt.Rows)
@@ -67,7 +74,7 @@ public class ResetSmallStoreHelper
                         }
                         }
                         db.SaveChanges();
                         db.SaveChanges();
                     }
                     }
-                // }
+                }
             }
             }
             catch (Exception ex)
             catch (Exception ex)
             {
             {