Procházet zdrojové kódy

wifi订单统计逻辑变更

lcl před 6 měsíci
rodič
revize
1859d2fbc6

+ 18 - 17
AppStart/Helper/SycnSpServer/SycnSpTradeWifiService.cs

@@ -121,37 +121,38 @@ namespace MySystem
                             }
 
                             add.Duration = Months;
+                            add.DoMonths = 1;
                             add.Unit = "m";
                             db.SaveChanges();
 
-                            if(Months > 0)
-                            {
+                            // if(Months > 0)
+                            // {
                                 decimal TradeAmt = TradeAmount / Months;
                                 TradeAmt = PublicFunction.NumberFormat(TradeAmt);
-                                string TradeMonth = DateTime.Now.AddMonths(-1).ToString("yyyyMM");
-                                if(statFlag)
-                                {
-                                    PxcModels.TradeDaySummary stat = db.TradeDaySummary.Where(m => m.UserId == pos.BuyUserId && m.BrandId == pos.BrandId).OrderByDescending(m => m.Id).FirstOrDefault() ?? new PxcModels.TradeDaySummary();
-                                    TradeMonth = string.IsNullOrEmpty(stat.TradeMonth) ? DateTime.Now.AddMonths(-1).ToString("yyyyMM") : stat.TradeMonth;
-                                }
-                                DateTime StartMonth = DateTime.Parse(TradeMonth.Substring(0, 4) + "-" + TradeMonth.Substring(4, 2) + "-01 00:00:00");
-                                for (int i = 1; i <= Months; i++)
-                                {
-                                    StartMonth = StartMonth.AddMonths(1);
-                                    StatTrade(db, pos.BuyUserId, pos.BrandId, StartMonth.ToString("yyyyMM"), TradeAmt);
+                                string TradeMonth = DateTime.Now.ToString("yyyyMM");
+                                // if(statFlag)
+                                // {
+                                //     PxcModels.TradeDaySummary stat = db.TradeDaySummary.Where(m => m.UserId == pos.BuyUserId && m.BrandId == pos.BrandId).OrderByDescending(m => m.Id).FirstOrDefault() ?? new PxcModels.TradeDaySummary();
+                                //     TradeMonth = string.IsNullOrEmpty(stat.TradeMonth) ? DateTime.Now.AddMonths(-1).ToString("yyyyMM") : stat.TradeMonth;
+                                // }
+                                // DateTime StartMonth = DateTime.Parse(TradeMonth.Substring(0, 4) + "-" + TradeMonth.Substring(4, 2) + "-01 00:00:00");
+                                // for (int i = 1; i <= Months; i++)
+                                // {
+                                    // StartMonth = StartMonth.AddMonths(1);
+                                    StatTrade(db, pos.BuyUserId, pos.BrandId, TradeMonth, TradeAmt);
                                     if (pos.BindingTime < DateTime.Now.AddMonths(-9))
                                     {
-                                        StatTradeBefore(db, pos.BuyUserId, pos.BrandId, StartMonth.ToString("yyyyMM"), TradeAmt);
+                                        StatTradeBefore(db, pos.BuyUserId, pos.BrandId, TradeMonth, TradeAmt);
                                     }
                                     else
                                     {
-                                        StatTradeAfter(db, pos.BuyUserId, pos.BrandId, StartMonth.ToString("yyyyMM"), TradeAmt);
+                                        StatTradeAfter(db, pos.BuyUserId, pos.BrandId, TradeMonth, TradeAmt);
                                     }
                                     //推送延时队列
                                     // TimeSpan ts = DateTime.Now - StartMonth;
                                     // RabbitMQClientV2.Instance.SendMsg("{\"pos_sn\":\"" + pos.PosSn + "\",\"amt\":\"" + TradeAmt + "\"}", "KXS_WIFI_TRADE_QUEUE", (uint)ts.TotalMilliseconds);
-                                }
-                            }
+                                // }
+                            // }
 
                             //检查交易状态,并发奖励
                             if(pos.ActivationState == 1)