Browse Source

查找辛海军团队循环最终机具

lichunlei 2 years ago
parent
commit
6e65f76aaa
2 changed files with 17 additions and 7 deletions
  1. 16 6
      Controllers/HomeController.cs
  2. 1 1
      Startup.cs

+ 16 - 6
Controllers/HomeController.cs

@@ -884,7 +884,13 @@ namespace MySystem.Controllers
         public string leaderflag()
         {
             WebCMSEntities db = new WebCMSEntities();
-            List<PosCoupons> coupons = db.PosCoupons.Where(m => m.LeaderUserId > 0 && m.IsUse == 1).ToList();
+            List<int> ids = new List<int>();
+            List<PosCouponRecord> records = db.PosCouponRecord.Where(m => m.FromUserId == 597).ToList();
+            foreach(PosCouponRecord record in records)
+            {
+                ids.Add(record.PosCouponId);
+            }
+            List<PosCoupons> coupons = db.PosCoupons.Where(m => ids.Contains(m.Id) && m.IsUse == 1).ToList();
             foreach (PosCoupons coupon in coupons)
             {
                 MachineApply apply = db.MachineApply.FirstOrDefault(m => m.SwapSnExpand.Contains(coupon.ExchangeCode));
@@ -904,7 +910,7 @@ namespace MySystem.Controllers
                     }
                 }
             }
-            db.SaveChanges();
+            // db.SaveChanges();
             db.Dispose();
             return "ok";
         }
@@ -931,8 +937,10 @@ namespace MySystem.Controllers
                         PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m=>m.Id == forSnNo.SnId);
                         if(pos != null)
                         {
-                            pos.LeaderUserId = LeaderUserId;
-                            Library.function.WriteLog(LeaderUserId + ":" + pos.PosSn + ":" + apply.SwapSnExpand.TrimEnd('\n').Split('\n').Length, "大盟主奖励标记机具");
+                            // pos.LeaderUserId = LeaderUserId;
+                            // Library.function.WriteLog(LeaderUserId + ":" + pos.PosSn + ":" + apply.SwapSnExpand.TrimEnd('\n').Split('\n').Length, "大盟主奖励标记机具");
+                            Users user = db.Users.FirstOrDefault(m => m.Id == pos.BuyUserId) ?? new Users();
+                            Library.function.WriteLog(pos.PosSn + ":" + user.MakerCode + ":" + user.RealName, "大盟主奖励标记机具");
                         }
                     }
                 }
@@ -943,8 +951,10 @@ namespace MySystem.Controllers
                 PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m=>m.Id == forSnNo.SnId);
                 if(pos != null)
                 {
-                    pos.LeaderUserId = LeaderUserId;
-                    Library.function.WriteLog(LeaderUserId + ":" + pos.PosSn, "大盟主奖励标记机具");
+                    // pos.LeaderUserId = LeaderUserId;
+                    // Library.function.WriteLog(LeaderUserId + ":" + pos.PosSn, "大盟主奖励标记机具");
+                    Users user = db.Users.FirstOrDefault(m => m.Id == pos.BuyUserId) ?? new Users();
+                    Library.function.WriteLog(pos.PosSn + ":" + user.MakerCode + ":" + user.RealName, "大盟主奖励标记机具");
                 }
             }
         }

+ 1 - 1
Startup.cs

@@ -212,7 +212,7 @@ namespace MySystem
             // MessageCenterService.Instance.Start(); // 消息队列
             // StatServiceTmp.Instance.Start();
             // StatService.Instance.StartEverDay("");
-            StatService.Instance.StartEverDayV2();
+            // StatService.Instance.StartEverDayV2();
             // RedPackageHelper.Instance.Start();
             // StatService.Instance.StatUserLevel();
             // ProfitHelper.Instance.StatProfit("202205"); //统计分润