Browse Source

添加补奖励临时程序

lcl 1 year ago
parent
commit
f9dd33ebfe
1 changed files with 48 additions and 3 deletions
  1. 48 3
      Controllers/HomeController.cs

+ 48 - 3
Controllers/HomeController.cs

@@ -269,17 +269,62 @@ namespace MySystem.Controllers
 
         public string add()
         {
+            DateTime now = DateTime.Now;
             WebCMSEntities db = new WebCMSEntities();
             List<string> poslist = new List<string>();
             poslist.Add("00002402045980179525");
-            poslist.Add("00002402045980181760");
             foreach(string PosSn in poslist)
             {
                 PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.PosSn == PosSn);
                 if(pos != null)
                 {
-                    // SycnSpTradeService.Instance.ActPos(db, pos, 1000, 30);
-                    // RedisDbconn.Instance.AddList("DepositActPrizeQueue", pos.Id);
+                    PxcModels.PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId);
+                    if (merchant != null)
+                    {
+                        DateTime TransferTime = pos.TransferTime == null ? DateTime.Now : pos.TransferTime.Value;
+
+                        //广电卡批量补盟主奖励和运营中心奖励
+                        if (pos.CreditTrade >= 1000 && pos.BuyUserId > 0 && pos.ActivationState == 0 && TransferTime.AddMinutes(-30) < pos.BindingTime)
+                        {
+                            if(pos.BindingTime > now.AddDays(-30) && pos.CardType < 100)
+                            {
+                                if(pos.BrandId == 14)
+                                {
+                                    if(pos.LeaderUserId > 0 && db.Leaders.Any(m => m.Id == pos.LeaderUserId && m.ExpiredDate > now))
+                                    {
+                                        RedisDbconn.Instance.AddList("LeaderPrizeQueue", pos.Id);
+                                    }
+                                    RedisDbconn.Instance.AddList("OperatePrizeQueue", pos.Id);
+                                }
+                            }
+                        }
+
+                        //0押金返30的奖励批量补录
+                        if(pos.ActivationState == 1 && (string.IsNullOrEmpty(pos.SeoKeyword) || pos.SeoKeyword == "0") && pos.CreditTrade >= 5000)
+                        {
+                            Users user = db.Users.FirstOrDefault(m => m.Id == pos.BuyUserId);
+                            if (user != null)
+                            {
+                                int GetUserId = user.Id;
+                                string ParentNav = user.ParentNav;
+                                int TopUserId = 0;
+                                if (!string.IsNullOrEmpty(ParentNav))
+                                {
+                                    TopUserId = int.Parse(ParentNav.Trim(',').Replace(",,", ",").Split(',')[0]);
+                                }
+                                if(pos.BindingTime.Value.AddDays(30) >= pos.ActivationTime)
+                                {
+                                    StatService.Instance.doActiveReward(db, merchant, pos, GetUserId, ParentNav, TopUserId, 30);
+                                }
+                            }
+                        }
+                    }
+
+                    //批量补服务费奖励
+                    if(decimal.Parse(function.CheckNum(pos.SeoKeyword)) > 0)
+                    {
+                        StatService.Instance.PreActPrize(db, pos, merchant, pos.SeoKeyword);
+                    }
                 }
             }
             db.Dispose();