Prechádzať zdrojové kódy

wifi交易后,判断是否激活,是的话就直接发奖励

lcl 10 mesiacov pred
rodič
commit
2baab2bf2e

+ 26 - 20
AppStart/Helper/SycnSpServer/SycnSpMerchantService.cs

@@ -5,6 +5,7 @@ using MySystem.SpModels;
 using Library;
 using LitJson;
 using System.Threading;
+using MySystem.MpMainModels;
 
 namespace MySystem
 {
@@ -215,26 +216,7 @@ namespace MySystem
                                     db.SaveChanges();
 
                                     //检查交易状态,并发奖励
-                                    PxcModels.WifiTradeRecord trade = db.WifiTradeRecord.FirstOrDefault(m => m.SnNo == pos.PosSn && m.Status == 0);
-                                    if (trade != null)
-                                    {
-                                        trade.Status = 1;
-                                        db.SaveChanges();
-                                        Prize = trade.TradeAmount * 0.15M;
-                                        StatService.Instance.doActiveReward(db, add, pos, pos.BuyUserId, user.ParentNav, TopUserId, Prize);
-                                        if (pos.CardType < 100)
-                                        {
-                                            RedisDbconn.Instance.AddList("OpenRewardQueue", pos.Id.ToString());
-                                        }
-                                        if (pos.LeaderUserId > 0 && db.Leaders.Any(m => m.Id == pos.LeaderUserId && m.ExpiredDate > DateTime.Now) && pos.CardType < 100)
-                                        {
-                                            RedisDbconn.Instance.AddList("LeaderPrizeQueue", pos.Id);
-                                        }
-                                        if (pos.CardType < 100)
-                                        {
-                                            RedisDbconn.Instance.AddList("OperatePrizeQueue", pos.Id);
-                                        }
-                                    }
+                                    WifiSendPrize(db, pos, add);
                                 }
 
                                 Merchants edit = spdb.Merchants.FirstOrDefault(m => m.Id == Mer.Id);
@@ -265,5 +247,29 @@ namespace MySystem
                 Thread.Sleep(1000);
             }
         }
+
+        public void WifiSendPrize(PxcModels.WebCMSEntities db, PxcModels.PosMachinesTwo pos, PxcModels.PosMerchantInfo add)
+        {
+            PxcModels.WifiTradeRecord trade = db.WifiTradeRecord.FirstOrDefault(m => m.SnNo == pos.PosSn && m.Status == 0);
+            if (trade != null)
+            {
+                trade.Status = 1;
+                db.SaveChanges();
+                decimal Prize = trade.TradeAmount * 0.15M;
+                StatService.Instance.doActiveReward(db, add, pos, pos.BuyUserId, "", 1, Prize);
+                if (pos.CardType < 100)
+                {
+                    RedisDbconn.Instance.AddList("OpenRewardQueue", pos.Id.ToString());
+                }
+                if (pos.LeaderUserId > 0 && db.Leaders.Any(m => m.Id == pos.LeaderUserId && m.ExpiredDate > DateTime.Now) && pos.CardType < 100)
+                {
+                    RedisDbconn.Instance.AddList("LeaderPrizeQueue", pos.Id);
+                }
+                if (pos.CardType < 100)
+                {
+                    RedisDbconn.Instance.AddList("OperatePrizeQueue", pos.Id);
+                }
+            }
+        }
     }
 }

+ 7 - 0
AppStart/Helper/SycnSpServer/SycnSpTradeWifiService.cs

@@ -94,6 +94,13 @@ namespace MySystem
                                 }
                             }
 
+                            //检查交易状态,并发奖励
+                            if(pos.ActivationState == 1)
+                            {
+                                PxcModels.PosMerchantInfo add = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId) ?? new PxcModels.PosMerchantInfo();
+                                SycnSpMerchantService.Instance.WifiSendPrize(db, pos, add);
+                            }
+
                             TradeRecord edit = spdb.TradeRecord.FirstOrDefault(m => m.Id == trade.Id);
                             if (edit != null)
                             {