瀏覽代碼

记录奖励逻辑日志

lcl 11 月之前
父節點
當前提交
bbfd430afd

二進制
.DS_Store


+ 38 - 7
AppStart/Helper/PosCouponPrize/PosCouponPrizeService.cs

@@ -61,9 +61,11 @@ namespace MySystem
                 ChkIds.Add(78);
                 ChkIds.Add(79);
                 ChkIds.Add(92);
+                Utils.Instance.PrizeRecord(2, order.OrderNo, "条件:商品id是(10,11,77,78,79,91);当前订单商品Id:" + order.ProductId + "");
                 //判断是否是指定商品
                 if(ChkIds.Contains(order.ProductId))
                 {
+                    Utils.Instance.PrizeRecord(2, order.OrderNo, "满足条件");
                     int Kind = 0;
                     if (order.ProductId == 10)
                     {
@@ -98,30 +100,49 @@ namespace MySystem
                     bool BackAccountFlag = false; //备用金返余额标识
                     bool BigLeaderFlag = false; //大盟主标记
                     decimal BuyPrize = 0; //购机奖励
+                    Utils.Instance.PrizeRecord(2, order.OrderNo, "开始向上递归查找");
                     foreach(string ParentId in ParentNavList)
                     {
                         UserRankItem parentUser = GetUserLevel(int.Parse(ParentId));
+                        Utils.Instance.PrizeRecord(2, order.OrderNo, "创客编号:" + parentUser.MakerCode + ";创客姓名:" + parentUser.RealName + ";");
                         index += 1;
+                        if(index == 1)
+                        {
+                            Utils.Instance.PrizeRecord(2, order.OrderNo, "条件:下单人是盟主;下单人盟主等级:" + orderUser.LeaderLevel + "");
+                            Utils.Instance.PrizeRecord(2, order.OrderNo, "条件:下单人是运营中心或合伙人;下单人合伙人等级:" + orderUser.OperateLevel + "");
+                            Utils.Instance.PrizeRecord(2, order.OrderNo, "条件:推荐奖励是否已发放;当前状态:" + DirectPrizeFlag + "");
+                        }
                         if(index == 1 && (orderUser.LeaderLevel > 0 || orderUser.OperateLevel > 0) && !DirectPrizeFlag)
                         {
+                            Utils.Instance.PrizeRecord(2, order.OrderNo, "满足条件,发放推荐奖励给下单人");
                             DirectPrize(db, order.Id, order.UserId, order.BuyCount);
                             DirectPrizeFlag = true;
                         }
                         if(index > 1)
                         {
-                            if(Utils.Instance.IsStandardUser(parentUser.Id) && !DirectPrizeFlag)
+                            bool IsStandardUser = Utils.Instance.IsStandardUser(parentUser.Id);
+                            Utils.Instance.PrizeRecord(2, order.OrderNo, "条件:上级是有效创客;是否有效创客:" + IsStandardUser + "");
+                            Utils.Instance.PrizeRecord(2, order.OrderNo, "条件:推荐奖励是否已发放;当前状态:" + DirectPrizeFlag + "");
+                            if(IsStandardUser && !DirectPrizeFlag)
                             {
+                                Utils.Instance.PrizeRecord(2, order.OrderNo, "满足条件,发放推荐奖励给上级");
                                 DirectPrize(db, order.Id, parentUser.Id, order.BuyCount);
                                 DirectPrizeFlag = true;
                             }
                         }
+                        Utils.Instance.PrizeRecord(2, order.OrderNo, "条件:创客是盟主;创客盟主等级:" + parentUser.AgoLeaderLevel + "");
+                        Utils.Instance.PrizeRecord(2, order.OrderNo, "条件:盟主储备金是否充足;");
+                        Utils.Instance.PrizeRecord(2, order.OrderNo, "条件:创客是运营中心或合伙人;合伙人等级:" + parentUser.AgoLeaderLevel + "");
+                        Utils.Instance.PrizeRecord(2, order.OrderNo, "条件:合伙人未使用额度是否充足;");
                         if(parentUser.AgoLeaderLevel > 0 && CheckLeaderReserve(db, order.BuyCount, parentUser.Id))
                         {
+                            Utils.Instance.PrizeRecord(2, order.OrderNo, "满足条件,发放购机奖");
                             //购机奖
                             if(parentUser.LeaderLevel > 0)
                             {
                                 decimal CurBuyPrize = GetBuyPrize(parentUser, order.UserId);
                                 decimal GetPrize = CurBuyPrize - BuyPrize;
+                                Utils.Instance.PrizeRecord(2, order.OrderNo, "发放金额:" + GetPrize);
                                 if(GetPrize > 0) 
                                 {
                                     bool PrizeFlag = true;
@@ -156,12 +177,21 @@ namespace MySystem
                             }
 
                             //给券打大盟主标记
+                            Utils.Instance.PrizeRecord(2, order.OrderNo, "条件:创客是盟主;创客盟主等级:" + parentUser.LeaderLevel + "");
+                            Utils.Instance.PrizeRecord(2, order.OrderNo, "条件:盟主储备金是否充足;");
                             if(parentUser.LeaderLevel == 1 && CheckLeaderReserve(db, order.BuyCount, parentUser.Id) && !BigLeaderFlag)
                             {
-                                BigLeaderFlag = CheckPosCouponLeaderFlag(db, parentUser.Id, order.BuyCount, codes);
+                                Utils.Instance.PrizeRecord(2, order.OrderNo, "满足小盟主条件,开始检查大盟主关联的额度");
+                                int LeaderId = CheckPosCouponLeaderFlag(db, parentUser.Id, order.BuyCount, codes);
+                                if(LeaderId > 0)
+                                {
+                                    BigLeaderFlag = true;
+                                    Utils.Instance.PrizeRecord(2, order.OrderNo, "满足条件,大盟主标记打给" + LeaderId);
+                                }
                             }
                             else if(parentUser.LeaderLevel == 2 && !BigLeaderFlag)
                             {
+                                Utils.Instance.PrizeRecord(2, order.OrderNo, "满足大盟主条件,大盟主标记打给" + parentUser.Id);
                                 BigLeaderFlag = true;
                                 if(!string.IsNullOrEmpty(order.SnNos))
                                 {
@@ -172,9 +202,11 @@ namespace MySystem
                         }
                         else if(parentUser.OperateLevel > 0 && CheckOpReserve(opdb, order.BuyCount, parentUser.Id))
                         {
+                            Utils.Instance.PrizeRecord(2, order.OrderNo, "满足条件,发放购机奖");
                             //购机奖
                             decimal CurBuyPrize = GetBuyPrize(parentUser, order.UserId);
                             decimal GetPrize = CurBuyPrize - BuyPrize;
+                            Utils.Instance.PrizeRecord(2, order.OrderNo, "发放金额:" + GetPrize);
                             if(GetPrize > 0)
                             {
                                 int ChangeType = 120;
@@ -938,15 +970,15 @@ namespace MySystem
             return SetCount;
         }
 
-        public bool CheckPosCouponLeaderFlag(WebCMSEntities db, int UserId, int Count, List<string> codes)
+        public int CheckPosCouponLeaderFlag(WebCMSEntities db, int UserId, int Count, List<string> codes)
         {
-            int SetCount = 0;
+            int LeaderUserId = 0;
             decimal CheckReserve = 400 * Count;
             // decimal LeaderReserve = 0;
             LeaderReserveRecord ReserveRecord = db.LeaderReserveRecord.FirstOrDefault(m => m.SourceUserId == UserId && m.Remark == "推荐小盟主" && m.ChangeAmt - m.UsedReserve > CheckReserve);
             if(ReserveRecord != null)
             {
-                int LeaderUserId = ReserveRecord.UserId;
+                LeaderUserId = ReserveRecord.UserId;
                 // if(ReserveRecord.ChangeAmt - ReserveRecord.UsedReserve >= CheckReserve)
                 // {
                     // LeaderReserve = CheckReserve;
@@ -979,12 +1011,11 @@ namespace MySystem
                     if(coupon != null)
                     {
                         coupon.LeaderUserId = LeaderUserId;
-                        SetCount += 1;
                     }
                 }
                 db.SaveChanges();
             }
-            return SetCount > 0;
+            return LeaderUserId;
         }
 
         /// <summary>

+ 1 - 1
AppStart/Helper/SycnSpServer/SycnSpBindService.cs

@@ -338,7 +338,7 @@ namespace MySystem
                                 MachineData.BindCount += 1;
                                 MachineData.UnBindCount -= 1;
 
-                                Utils.Instance.PrizeRecord(db, 1, pos.PosSn, "广电卡,激活状态:" + Bind.Field5);
+                                Utils.Instance.PrizeRecord(1, pos.PosSn, "广电卡,激活状态:" + Bind.Field5);
                                 if(Bind.Field5 == "已激活")
                                 {
                                     bool PrizeFlag = pos.CardType > 0;

+ 29 - 29
AppStart/Helper/SycnSpServer/SycnSpTradeService.cs

@@ -819,23 +819,23 @@ namespace MySystem
             {
                 minute = 60 * 24 * 30;
             }
-            Utils.Instance.PrizeRecord(db, 1, pos.PosSn, "条件:贷记卡是否刷满" + CheckMoney + ";贷记卡交易:" + pos.CreditTrade + "");
-            Utils.Instance.PrizeRecord(db, 1, pos.PosSn, "条件:是否有机具所属人;机具所属人Id:" + pos.BuyUserId + "");
-            Utils.Instance.PrizeRecord(db, 1, pos.PosSn, "条件:是否未激活;机具激活状态:" + pos.ActivationState + "");
-            Utils.Instance.PrizeRecord(db, 1, pos.PosSn, "条件:划拨时间不能超过绑定时间" + minute + "分钟;划拨时间:" + pos.TransferTime.Value.ToString() + ",绑定时间:" + pos.BindingTime.Value.ToString());
+            Utils.Instance.PrizeRecord(1, pos.PosSn, "条件:贷记卡是否刷满" + CheckMoney + ";贷记卡交易:" + pos.CreditTrade + "");
+            Utils.Instance.PrizeRecord(1, pos.PosSn, "条件:是否有机具所属人;机具所属人Id:" + pos.BuyUserId + "");
+            Utils.Instance.PrizeRecord(1, pos.PosSn, "条件:是否未激活;机具激活状态:" + pos.ActivationState + "");
+            Utils.Instance.PrizeRecord(1, pos.PosSn, "条件:划拨时间不能超过绑定时间" + minute + "分钟;划拨时间:" + pos.TransferTime.Value.ToString() + ",绑定时间:" + pos.BindingTime.Value.ToString());
             if (pos.CreditTrade >= CheckMoney && pos.BuyUserId > 0 && pos.ActivationState == 0 && TransferTime.AddMinutes(-minute) < pos.BindingTime)
             {
-                Utils.Instance.PrizeRecord(db, 1, pos.PosSn, "满足条件");
+                Utils.Instance.PrizeRecord(1, pos.PosSn, "满足条件");
                 pos.ActivationState = 1;
                 pos.ActivationTime = now;
-                Utils.Instance.PrizeRecord(db, 1, pos.PosSn, "条件:是否营训");
+                Utils.Instance.PrizeRecord(1, pos.PosSn, "条件:是否营训");
                 if(pos.CardType == 101)
                 {
-                    Utils.Instance.PrizeRecord(db, 1, pos.PosSn, "是营训");
+                    Utils.Instance.PrizeRecord(1, pos.PosSn, "是营训");
                     pos.IsPurchase = 1;
-                    Utils.Instance.PrizeRecord(db, 1, pos.PosSn, "取消循环资格");
+                    Utils.Instance.PrizeRecord(1, pos.PosSn, "取消循环资格");
                 }
-                Utils.Instance.PrizeRecord(db, 1, pos.PosSn, "条件:是否关联商户信息");
+                Utils.Instance.PrizeRecord(1, pos.PosSn, "条件:是否关联商户信息");
                 PxcModels.PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId);
                 if (merchant != null)
                 {
@@ -843,26 +843,26 @@ namespace MySystem
                     merchant.MerStandardDate = now;
                     db.SaveChanges();
 
-                    Utils.Instance.PrizeRecord(db, 1, pos.PosSn, "已关联");
+                    Utils.Instance.PrizeRecord(1, pos.PosSn, "已关联");
                     //发放开机奖励
-                    Utils.Instance.PrizeRecord(db, 1, pos.PosSn, "条件:绑定时间不超过" + CheckDays + "天;当前绑定时间:" + pos.BindingTime.ToString() + "");
-                    Utils.Instance.PrizeRecord(db, 1, pos.PosSn, "条件:非营训;当前类型:" + pos.CardType);
-                    Utils.Instance.PrizeRecord(db, 1, pos.PosSn, "条件:奖励开关;当前:" + PrizeFlag);
+                    Utils.Instance.PrizeRecord(1, pos.PosSn, "条件:绑定时间不超过" + CheckDays + "天;当前绑定时间:" + pos.BindingTime.ToString() + "");
+                    Utils.Instance.PrizeRecord(1, pos.PosSn, "条件:非营训;当前类型:" + pos.CardType);
+                    Utils.Instance.PrizeRecord(1, pos.PosSn, "条件:奖励开关;当前:" + PrizeFlag);
                     if(pos.BindingTime > now.AddDays(-CheckDays) && pos.CardType < 100 && PrizeFlag)
                     {
-                        Utils.Instance.PrizeRecord(db, 1, pos.PosSn, "满足条件,发放开机奖励");
+                        Utils.Instance.PrizeRecord(1, pos.PosSn, "满足条件,发放开机奖励");
                         RedisDbconn.Instance.AddList("OpenRewardQueue", pos.Id.ToString());
                         if(pos.BrandId == 14)
                         {
-                            Utils.Instance.PrizeRecord(db, 1, pos.PosSn, "满足条件,发放运营中心奖励");
+                            Utils.Instance.PrizeRecord(1, pos.PosSn, "满足条件,发放运营中心奖励");
                             RedisDbconn.Instance.AddList("OperatePrizeQueue", pos.Id);
-                            Utils.Instance.PrizeRecord(db, 1, pos.PosSn, "条件:大盟主标记;当前大盟主Id:" + pos.LeaderUserId);
+                            Utils.Instance.PrizeRecord(1, pos.PosSn, "条件:大盟主标记;当前大盟主Id:" + pos.LeaderUserId);
                             PxcModels.Leaders leader = db.Leaders.FirstOrDefault(m => m.Id == pos.LeaderUserId) ?? new PxcModels.Leaders();
                             DateTime ExpiredDate = leader.ExpiredDate == null ? DateTime.Parse("1900-01-01") : leader.ExpiredDate.Value;
-                            Utils.Instance.PrizeRecord(db, 1, pos.PosSn, "条件:盟主是否过期;过期时间:" + pos.LeaderUserId);
+                            Utils.Instance.PrizeRecord(1, pos.PosSn, "条件:盟主是否过期;过期时间:" + pos.LeaderUserId);
                             if(pos.LeaderUserId > 0 && ExpiredDate > now)
                             {
-                                Utils.Instance.PrizeRecord(db, 1, pos.PosSn, "满足条件,发放大盟主奖励");
+                                Utils.Instance.PrizeRecord(1, pos.PosSn, "满足条件,发放大盟主奖励");
                                 RedisDbconn.Instance.AddList("LeaderPrizeQueue", pos.Id);
                             }
                         }
@@ -872,22 +872,22 @@ namespace MySystem
                 decimal Deposit = decimal.Parse(function.CheckNum(pos.SeoKeyword));
                 if(pos.BrandId != 14)
                 {
-                    Utils.Instance.PrizeRecord(db, 1, pos.PosSn, "条件:有押金;当前押金:" + Deposit);
-                    Utils.Instance.PrizeRecord(db, 1, pos.PosSn, "条件:大盟主标记;当前大盟主Id:" + pos.LeaderUserId);
+                    Utils.Instance.PrizeRecord(1, pos.PosSn, "条件:有押金;当前押金:" + Deposit);
+                    Utils.Instance.PrizeRecord(1, pos.PosSn, "条件:大盟主标记;当前大盟主Id:" + pos.LeaderUserId);
                     PxcModels.Leaders leader = db.Leaders.FirstOrDefault(m => m.Id == pos.LeaderUserId) ?? new PxcModels.Leaders();
                     DateTime ExpiredDate = leader.ExpiredDate == null ? DateTime.Parse("1900-01-01") : leader.ExpiredDate.Value;
-                    Utils.Instance.PrizeRecord(db, 1, pos.PosSn, "条件:盟主是否过期;过期时间:" + pos.LeaderUserId);
-                    Utils.Instance.PrizeRecord(db, 1, pos.PosSn, "条件:绑定时间不超过" + CheckDays + "天;绑定时间:" + pos.BindingTime.Value.ToString() + "");
+                    Utils.Instance.PrizeRecord(1, pos.PosSn, "条件:盟主是否过期;过期时间:" + pos.LeaderUserId);
+                    Utils.Instance.PrizeRecord(1, pos.PosSn, "条件:绑定时间不超过" + CheckDays + "天;绑定时间:" + pos.BindingTime.Value.ToString() + "");
                 }
                 if (Deposit > 0 && pos.LeaderUserId > 0 && db.Leaders.Any(m => m.Id == pos.LeaderUserId && m.ExpiredDate > now) && pos.BindingTime > now.AddDays(-CheckDays) && pos.CardType < 100 && PrizeFlag)
                 {
-                    Utils.Instance.PrizeRecord(db, 1, pos.PosSn, "满足条件,发放大盟主奖励");
+                    Utils.Instance.PrizeRecord(1, pos.PosSn, "满足条件,发放大盟主奖励");
                     RedisDbconn.Instance.AddList("LeaderPrizeQueue", pos.Id);
                 }
                 //发放运营中心奖励
                 if (Deposit > 0 && pos.BindingTime > now.AddDays(-CheckDays) && pos.CardType < 100 && PrizeFlag)
                 {
-                    Utils.Instance.PrizeRecord(db, 1, pos.PosSn, "满足条件,发放运营中心奖励");
+                    Utils.Instance.PrizeRecord(1, pos.PosSn, "满足条件,发放运营中心奖励");
                     RedisDbconn.Instance.AddList("OperatePrizeQueue", pos.Id);
                 }
                 if(pos.CardType < 100)
@@ -916,13 +916,13 @@ namespace MySystem
                 //推送激活数据
                 Utils.Instance.SendActData(pos);
             }
-            Utils.Instance.PrizeRecord(db, 1, pos.PosSn, "条件:已激活;当前状态:" + pos.ActivationState);
-            Utils.Instance.PrizeRecord(db, 1, pos.PosSn, "条件:绑定后台30天到60天之间;绑定时间:" + pos.BindingTime.Value.ToString() + "");
-            Utils.Instance.PrizeRecord(db, 1, pos.PosSn, "条件:贷记卡是否刷满10000;贷记卡交易:" + pos.CreditTrade + "");
-            Utils.Instance.PrizeRecord(db, 1, pos.PosSn, "条件:非营训;当前类型:" + pos.CardType);
+            Utils.Instance.PrizeRecord(1, pos.PosSn, "条件:已激活;当前状态:" + pos.ActivationState);
+            Utils.Instance.PrizeRecord(1, pos.PosSn, "条件:绑定后台30天到60天之间;绑定时间:" + pos.BindingTime.Value.ToString() + "");
+            Utils.Instance.PrizeRecord(1, pos.PosSn, "条件:贷记卡是否刷满10000;贷记卡交易:" + pos.CreditTrade + "");
+            Utils.Instance.PrizeRecord(1, pos.PosSn, "条件:非营训;当前类型:" + pos.CardType);
             if(pos.ActivationState == 1 && pos.BindingTime.Value.AddDays(30) <= DateTime.Now && pos.BindingTime.Value.AddDays(60) > DateTime.Now && pos.CreditTrade >= 10000 && pos.CardType < 100)
             {
-                Utils.Instance.PrizeRecord(db, 1, pos.PosSn, "满足条件,发放盟主开机奖励");
+                Utils.Instance.PrizeRecord(1, pos.PosSn, "满足条件,发放盟主开机奖励");
                 RedisDbconn.Instance.AddList("LeaderRewardQueue", pos.Id.ToString());
             }
         }