lcl 1 жил өмнө
parent
commit
7500c23929

+ 3 - 18
AppStart/Helper/StatService.cs

@@ -216,7 +216,7 @@ namespace MySystem
             KxsMainModels.WebCMSEntities maindb = new KxsMainModels.WebCMSEntities();
             try
             {
-                DataTable idsDt = CustomerSqlConn.dtable("select Id from PosMachinesTwo where QueryCount=0 and ActivationState=1 and ActivationTime is not null and BuyUserId>0 limit 50", AppConfig.Base.SqlConn);
+                DataTable idsDt = CustomerSqlConn.dtable("select Id from MerchantInfo where ActStat=0 and ActivationStatus=1 and ActivationDate is not null and UserId>0 limit 50", AppConfig.Base.SqlConn);
                 if(idsDt.Rows.Count > 0)
                 {
                     string ids = "";
@@ -224,14 +224,13 @@ namespace MySystem
                     {
                         ids += idsDr["Id"].ToString() + ",";
                     }
-                    DataTable userDt = CustomerSqlConn.dtable("select BuyUserId,StoreId,DATE_FORMAT(ActivationTime, '%Y%m%d'),count(Id) from PosMachinesTwo where Id in (" + ids.TrimEnd(',') + ") group by BuyUserId,StoreId,DATE_FORMAT(ActivationTime, '%Y%m%d')", AppConfig.Base.SqlConn);
+                    DataTable userDt = CustomerSqlConn.dtable("select UserId,DATE_FORMAT(ActivationDate, '%Y%m%d'),count(Id) from MerchantInfo where Id in (" + ids.TrimEnd(',') + ") group by UserId,DATE_FORMAT(ActivationDate, '%Y%m%d')", AppConfig.Base.SqlConn);
                     if (userDt.Rows.Count > 0)
                     {
                         function.WriteLog("人数:" + userDt.Rows.Count + "\n\n", "实时执行创客激活数日志");
                         foreach (DataRow userDr in userDt.Rows)
                         {
                             int UserId = int.Parse(userDr["BuyUserId"].ToString());
-                            int StoreId = int.Parse(userDr["StoreId"].ToString());
                             string TradeDate = userDr[3].ToString();
                             int ActCount = int.Parse(function.CheckInt(userDr[4].ToString()));
                             string TradeMonth = TradeDate.Substring(0, 6);
@@ -275,23 +274,9 @@ namespace MySystem
                                     teamStat.ActiveBuddyMerStatus += ActCount;
                                 }
                             }
-
-                            //统计分仓激活数
-                            StoreSnActivateSummary storeStat = db.StoreSnActivateSummary.FirstOrDefault(m => m.StoreId == StoreId && m.TradeMonth == TradeMonth && m.TradeDate == TradeDate);
-                            if (storeStat == null)
-                            {
-                                storeStat = db.StoreSnActivateSummary.Add(new StoreSnActivateSummary()
-                                {
-                                    StoreId = StoreId,
-                                    TradeMonth = TradeMonth,
-                                    TradeDate = TradeDate,
-                                }).Entity;
-                                db.SaveChanges();
-                            }
-                            storeStat.ActivateNum += ActCount;
                         }
                         db.SaveChanges();
-                        CustomerSqlConn.op("update PosMachinesTwo set QueryCount=1 where Id in (" + ids.TrimEnd(',') + ")", AppConfig.Base.SqlConn);
+                        CustomerSqlConn.op("update MerchantInfo set ActStat=1 where Id in (" + ids.TrimEnd(',') + ")", AppConfig.Base.SqlConn);
                     }
                 }
             }