Parcourir la source

每日重新统计当月交易额调整,加上稳定期B

lichunlei il y a 1 an
Parent
commit
8ef8caa05f
2 fichiers modifiés avec 28 ajouts et 2 suppressions
  1. BIN
      .DS_Store
  2. 28 2
      AppStart/Helper/StatService.cs

BIN
.DS_Store


+ 28 - 2
AppStart/Helper/StatService.cs

@@ -1777,19 +1777,45 @@ namespace MySystem
             {
                 CustomerSqlConn.op("update Users set ThisMonthTrade=0 where ThisMonthTrade>0", MysqlConn.SqlConnStr);
             }
+            string sql = "";
             DataTable list = CustomerSqlConn.dtable("select UserId,sum(HelpNonDirectTradeAmt+HelpNonDirectDebitTradeAmt+NotHelpNonDirectTradeAmt+NotHelpNonDirectDebitTradeAmt+ProfitNonDirectTradeAmt+ProfitNonDirectDebitTradeAmt) from TradeDaySummary where Id>=15055757 and TradeMonth='" + TradeMonth + "' and SeoTitle='team' and UserId>0 group by UserId", MysqlConn.ReadSqlConnStr);
+            int index = 0;
             foreach (DataRow dr in list.Rows)
             {
+                index += 1;
                 string UserId = dr["UserId"].ToString();
                 string ThisMonthTrade = dr[1].ToString();
-                CustomerSqlConn.op("update Users set ThisMonthTrade=" + ThisMonthTrade + " where Id=" + UserId, MysqlConn.SqlConnStr);
+                sql += "update Users set ThisMonthTrade=" + ThisMonthTrade + " where Id=" + UserId + ";";
+                if(index >= 200)
+                {
+                    CustomerSqlConn.op(sql, MysqlConn.SqlConnStr);
+                    sql = "";
+                    index = 0;
+                }
+            }
+            if(!string.IsNullOrEmpty(sql))
+            {
+                CustomerSqlConn.op(sql, MysqlConn.SqlConnStr);
             }
+            sql = "";
+            index = 0;
             list = CustomerSqlConn.dtable("select UserId,sum(ProfitTradeAmt+ProfitDebitTradeAmt) from TradeDaySummary2 where TradeMonth='" + TradeMonth + "' and SeoTitle='team' and UserId>0 group by UserId", MysqlConn.ReadSqlConnStr);
             foreach (DataRow dr in list.Rows)
             {
+                index += 1;
                 string UserId = dr["UserId"].ToString();
                 string ThisMonthTrade = dr[1].ToString();
-                CustomerSqlConn.op("update Users set ThisMonthTrade=ThisMonthTrade+" + ThisMonthTrade + " where Id=" + UserId, MysqlConn.SqlConnStr);
+                sql += "update Users set ThisMonthTrade=ThisMonthTrade+" + ThisMonthTrade + " where Id=" + UserId + ";";
+                if(index >= 200)
+                {
+                    CustomerSqlConn.op(sql, MysqlConn.SqlConnStr);
+                    sql = "";
+                    index = 0;
+                }
+            }
+            if(!string.IsNullOrEmpty(sql))
+            {
+                CustomerSqlConn.op(sql, MysqlConn.SqlConnStr);
             }
             // Thread th = new Thread(StatTradeAmountEverDay);
             // th.IsBackground = true;