浏览代码

Merge branch 'feat-lcl-训练营' of kxs-end/main-server into release-mainserver

lichunlei 11 月之前
父节点
当前提交
b93ef2ee39

+ 9 - 4
AppStart/Helper/PosCouponPrize/PosCouponPrizeService.cs

@@ -807,6 +807,7 @@ namespace MySystem
             {
                 return op;
             }
+            function.WriteLog("UserId:" + UserId, "训练营判断参与活动");
             WebCMSEntities maindb = new WebCMSEntities();
             Users muser = maindb.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
             string ParentNav = muser.ParentNav + "," + UserId + ",";
@@ -817,18 +818,22 @@ namespace MySystem
                 UserIds.Add(int.Parse(function.CheckInt(IdString)));
             } 
             JavaModels.WebCMSEntities db = new JavaModels.WebCMSEntities();
-            JavaModels.KxsCampUser user = db.KxsCampUser.FirstOrDefault(m => UserIds.Contains(m.UserId));
-            if(user != null)
+            var users = db.KxsCampUser.Where(m => UserIds.Contains(m.UserId)).ToList();
+            foreach(var user in users)
             {
                 DateTime now = DateTime.Now;
-                JavaModels.KxsCamp camp = db.KxsCamp.FirstOrDefault(m => m.Id == user.CampId && m.StartTime <= now && m.EndTime >= now);
-                if(user != null)
+                // JavaModels.KxsCamp camp = db.KxsCamp.FirstOrDefault(m => m.Id == user.CampId && m.StartTime <= now && m.EndTime >= now);
+                JavaModels.KxsCamp camp = db.KxsCamp.FirstOrDefault(m => m.Id == user.CampId && m.Status == 1);
+                if(camp != null)
                 {
+                    function.WriteLog("活动Id:" + camp.Id, "训练营判断参与活动");
                     op = false;
+                    break;
                 }
             }
             maindb.Dispose();
             db.Dispose();
+            function.WriteLog("\n\n\n", "训练营判断参与活动");
             return op;
         }
 

+ 2 - 42
AppStart/Helper/SycnSpServer/SycnSpTradeService.cs

@@ -894,52 +894,12 @@ namespace MySystem
                 //清理预扣款
                 RedisDbconn.Instance.AddList("PosWithholdQueue", "{\"UserId\":\"" + pos.BuyUserId + "\",\"SnNo\":\"" + pos.PosSn + "\"}");
 
-                //检查服务费推送过来的激活奖励是否发放
-                // function.WriteLog("PosSn:" + pos.PosSn, "检查服务费推送过来的激活奖励是否发放");
-                // decimal Deposit = decimal.Parse(function.CheckNum(pos.SeoKeyword));
-                // if(Deposit > 0)
-                // {
-                //     function.WriteLog("Deposit:" + Deposit, "检查服务费推送过来的激活奖励是否发放");
-                //     PxcModels.ActiveReward act = db.ActiveReward.FirstOrDefault(m => m.KqSnNo == pos.PosSn && m.ActType == 1 && m.UserId == 0);
-                //     if(act != null)
-                //     {
-                //         act.UserId = pos.BuyUserId;
-                //         function.WriteLog("1", "检查服务费推送过来的激活奖励是否发放");
-                //         PxcModels.UserAccountRecord accRec = db.UserAccountRecord.FirstOrDefault(m => m.QueryCount == pos.Id && m.UserId == 0);
-                //         if(accRec != null)
-                //         {
-                //             accRec.UserId = pos.BuyUserId;
-                //             function.WriteLog("2", "检查服务费推送过来的激活奖励是否发放");
-                //         }
-                //         PxcModels.UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == pos.BuyUserId);
-                //         if(account != null)
-                //         {
-                //             account.BalanceAmount += act.RewardAmount;
-                //             account.TotalAmount += act.RewardAmount;
-                //             db.SaveChanges();
-                //             function.WriteLog("发放:" + act.RewardAmount, "检查服务费推送过来的激活奖励是否发放"); 
-                //         }
-                //     }
-                // }
-                // function.WriteLog("\n\n", "检查服务费推送过来的激活奖励是否发放");
+                //推送激活数据
+                Utils.Instance.SendActData(pos);
             }
             if(pos.ActivationState == 1 && pos.BindingTime.Value.AddDays(30) <= DateTime.Now && pos.BindingTime.Value.AddDays(60) > DateTime.Now && pos.CreditTrade >= 10000 && pos.CardType < 100)
             {
                 RedisDbconn.Instance.AddList("LeaderRewardQueue", pos.Id.ToString());
-                // PxcModels.Users user = db.Users.FirstOrDefault(m => m.Id == pos.BuyUserId);
-                // if (user != null)
-                // {
-                //     if(user.LeaderLevel > 0 && db.Leaders.Any(m => m.Id == user.Id && m.ExpiredDate >= now))
-                //     {
-                //         int TopUserId = 0;
-                //         if (!string.IsNullOrEmpty(user.ParentNav))
-                //         {
-                //             TopUserId = int.Parse(user.ParentNav.Trim(',').Replace(",,", ",").Split(',')[0]);
-                //         }
-                //         PxcModels.PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId);
-                //         StatService.Instance.doActiveReward(db, merchant, pos, user.Id, user.ParentNav, TopUserId, 50);
-                //     }
-                // }
             }
         }
 

+ 19 - 0
Util/Utils.cs

@@ -321,6 +321,25 @@ namespace MySystem
             RedisDbconn.Instance.AddList("KxsOrderQueue", data);
         }
 
+        #endregion
+
+        #region 推送激活数据信息
+
+        public void SendActData(PosMachinesTwo pos)
+        {
+            int actType = pos.BrandId != 14 ? 1 : 2;
+            string data = "{";
+            data += "\"userId\":\"" + pos.BuyUserId + "\",";
+            data += "\"brandId\":\"" + pos.BrandId + "\",";
+            data += "\"actTime\":\"" + pos.ActivationTime.Value.ToString("yyyy-MM-ddTHH:mm:ss") + "\",";
+            data += "\"bindTime\":\"" + pos.BindingTime.Value.ToString("yyyy-MM-ddTHH:mm:ss") + "\",";
+            data += "\"sn\":\"" + pos.PosSn + "\",";
+            data += "\"actType\":\"" + actType + "\"";
+            data += "}";
+            function.WriteLog(DateTime.Now.ToString() + "\n" + data, "订单推送MQ日志");
+            RedisDbconn.Instance.AddList("KxsActQueue", data);
+        }
+
         #endregion