Quellcode durchsuchen

广电卡奖励整理,开始测试

lcl vor 1 Jahr
Ursprung
Commit
670ea263f7

+ 1 - 1
AppStart/Helper/LeaderPrizeService.cs

@@ -39,7 +39,7 @@ namespace MySystem
                             decimal ChangeAmount = 10;
                             if(pos.BrandId == 14)
                             {
-                                ChangeAmount = decimal.Parse(function.CheckNum(pos.SeoKeyword)) * 0.15M;
+                                ChangeAmount = 19 * 0.15M;
                             }
                             int LeaderUserId = pos.LeaderUserId;
                             UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == LeaderUserId);

+ 1 - 1
AppStart/Helper/OperatePrizeService.cs

@@ -63,7 +63,7 @@ namespace MySystem
                                 decimal ChangeAmount = 5;
                                 if(pos.BrandId == 14)
                                 {
-                                    ChangeAmount = decimal.Parse(function.CheckNum(pos.SeoKeyword)) * 0.05M;
+                                    ChangeAmount = 19 * 0.05M;
                                 }
                                 UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == OpId);
                                 if (account == null)

+ 85 - 26
AppStart/Helper/StatService.cs

@@ -128,6 +128,78 @@ namespace MySystem
 
 
 
+        //广电卡激活奖励
+        public void StartSimActive()
+        {
+            Thread th = new Thread(StartSimActiveListen);
+            th.IsBackground = true;
+            th.Start();
+        }
+
+        public void StartSimActiveListen()
+        {
+            while(true)
+            {
+                try
+                {
+                    function.WriteLog(DateTime.Now.ToString() + ":start", "实时处理广电卡激活奖励");
+                    
+                    function.WriteLog(DateTime.Now.ToString() + ":end\n\n", "实时处理广电卡激活奖励");
+                }
+                catch (Exception ex)
+                {
+                    function.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "实时处理广电卡激活奖励异常");
+                }
+                Thread.Sleep(29000);
+            }
+        }
+
+        public void StartSimActiveDo(int posid = 0)
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            DateTime yesterday = DateTime.Now.AddDays(-30);
+            DateTime today = DateTime.Now.AddMinutes(-10);
+            IQueryable<PosMachinesTwo> posList = db.PosMachinesTwo.Where(m => m.ActivationState == 1 && m.BrandId == 14 && m.Detail != "1");
+            if (posid > 0)
+            {
+                posList = posList.Where(m => m.Id == posid);
+            }
+            else
+            {
+                posList = posList.Where(m => m.ActivationTime >= yesterday && m.ActivationTime < today);
+            }
+            foreach (PosMachinesTwo pos in posList.ToList())
+            {
+                PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId);
+                if (merchant != null)
+                {
+                    string ParentNav = "";
+                    Users user = db.Users.FirstOrDefault(m => m.Id == pos.BuyUserId);
+                    if (user != null)
+                    {
+                        int GetUserId = user.Id;
+                        ParentNav = user.ParentNav;
+                        int TopUserId = 0;
+                        if (!string.IsNullOrEmpty(ParentNav))
+                        {
+                            TopUserId = int.Parse(ParentNav.Trim(',').Replace(",,", ",").Split(',')[0]);
+                        }
+                        decimal Amount = 19 * 1.5M;
+                        doActiveReward(db, merchant, pos, GetUserId, ParentNav, TopUserId, Amount);
+                        PosMachinesTwo item = db.PosMachinesTwo.FirstOrDefault(m => m.Id == pos.Id);
+                        if(item != null)
+                        {
+                            item.Detail = "1";
+                            db.SaveChanges();
+                        }
+                    }
+                }
+            }
+            db.Dispose();
+        }
+
+
+
 
 
 
@@ -316,33 +388,25 @@ namespace MySystem
                         }
                         if (ActPrize > 0)
                         {
-                            if(pos.BrandId == 14)
+                            if (ActPrize == 99)
                             {
-                                ActPrize = ActPrize * 1.5M;
+                                ActPrize = 100;
                             }
-                            else
+                            else if (ActPrize == 199)
                             {
-                                if (ActPrize == 99)
-                                {
-                                    ActPrize = 100;
-                                }
-                                else if (ActPrize == 199)
-                                {
-                                    ActPrize = 200;
-                                }
-                                else if (ActPrize == 299)
-                                {
-                                    ActPrize = 300;
-                                }
-                                else if (ActPrize == 249)
-                                {
-                                    ActPrize = 260;
-                                }
+                                ActPrize = 200;
+                            }
+                            else if (ActPrize == 299)
+                            {
+                                ActPrize = 300;
+                            }
+                            else if (ActPrize == 249)
+                            {
+                                ActPrize = 260;
                             }
                             if (GetUserId > 0)
                             {
                                 doActiveReward(db, merchant, pos, GetUserId, ParentNav, TopUserId, ActPrize);
-                                doJk30(db, pos, merchant, GetUserId, ParentNav, TopUserId);
                             }
                         }
                         else if(ActPrize == 0)
@@ -418,11 +482,6 @@ namespace MySystem
                         {
                             doActiveReward(db, merchant, pos, GetUserId, ParentNav, TopUserId, 50);
                         }
-                        else
-                        {
-                            //金控活动机返奖励
-                            doJk30(db, pos, merchant, GetUserId, ParentNav, TopUserId);
-                        }
                         PosMachinesTwo edit = db.PosMachinesTwo.FirstOrDefault(m => m.Id == pos.Id);
                         if(edit != null)
                         {
@@ -1098,7 +1157,7 @@ namespace MySystem
                                                 decimal Prize = 20;
                                                 if(pos.BrandId == 14)
                                                 {
-                                                    Prize = ActPrize * 0.3M;
+                                                    Prize = 19 * 0.3M;
                                                 }
                                                 string[] ParentNavs = ParentNav.Trim(',').Replace(",,", ",").Split(',');
                                                 for (int i = ParentNavs.Length - 1; i >= 0; i--)

+ 39 - 34
AppStart/Helper/SycnSpServer/SycnSpBindService.cs

@@ -31,7 +31,7 @@ namespace MySystem
                     PxcModels.WebCMSEntities db = new PxcModels.WebCMSEntities();
                     DateTime start = DateTime.Now.AddDays(-5);
                     int StartId = int.Parse(function.CheckInt(function.ReadInstance("/SycnSp/BindRecordId.txt")));
-                    var Binds = spdb.BindRecord.Select(m => new { m.Id, m.CreateTime, m.Status, m.MerNo, m.MerSnNo, m.ProductType, m.Remark, m.Field1, m.Field2, m.Field3, m.Field5 }).Where(m => m.Id >= StartId && m.CreateTime >= start && m.Status == 1).OrderByDescending(m => m.Id).ToList();
+                    var Binds = spdb.BindRecord.Select(m => new { m.Id, m.CreateTime, m.Status, m.MerNo, m.MerSnNo, m.ProductType, m.Remark, m.Field1, m.Field2, m.Field3, m.Field5, m.SeoTitle }).Where(m => m.Id >= StartId && m.CreateTime >= start && m.Status == 1).OrderByDescending(m => m.Id).ToList();
                     foreach (var Bind in Binds)
                     {
                         var tran = db.Database.BeginTransaction();
@@ -97,43 +97,48 @@ namespace MySystem
                                     //广电卡逻辑
                                     if(pos.BrandId == 14)
                                     {
-                                        if (Bind.Field2.Contains("副卡") || Bind.Field3.Contains("副卡"))
+                                        string KindName = Bind.Remark; //商品类型名称
+                                        string Name = Bind.Field3; //商品名称
+                                        decimal ActualAmount = decimal.Parse(function.CheckNum(Bind.SeoTitle)); //实付金额
+                                        string ActStatus = Bind.Field5; //激活状态名称
+                                        if (KindName == "基础套餐" && Name == "双百套餐" && ActStatus == "已激活" && ActualAmount >= 100)
                                         {
-                                            pos.Detail = "1";
+                                            // if (function.CheckNull(Bind.Field3).Contains("元"))
+                                            // {
+                                            //     string[] data = Bind.Field3.Split(new string[] { "元" }, StringSplitOptions.None);
+                                            //     string dataTmp = data[0];
+                                            //     string resultNum = "";
+                                            //     for (int i = dataTmp.Length - 1; i >= 0; i--)
+                                            //     {
+                                            //         string checkStr = dataTmp.Substring(i, 1);
+                                            //         if (function.IsInt(checkStr) || checkStr == ".")
+                                            //         {
+                                            //             resultNum = checkStr + resultNum;
+                                            //         }
+                                            //         else
+                                            //         {
+                                            //             break;
+                                            //         }
+                                            //     }
+                                            //     decimal Deposit = decimal.Parse(function.CheckNum(resultNum));
+                                            //     if (Deposit > 0)
+                                            //     {
+                                            //         pos.SeoKeyword = Deposit.ToString();
+                                            //     }
+                                            //     else
+                                            //     {
+                                            //         pos.Detail = "1";
+                                            //     }
+                                            // }
+                                            // else
+                                            // {
+                                            //     pos.Detail = "1";
+                                            // }
+                                            pos.Detail = "0";
                                         }
                                         else
                                         {
-                                            if (function.CheckNull(Bind.Field3).Contains("元"))
-                                            {
-                                                string[] data = Bind.Field3.Split(new string[] { "元" }, StringSplitOptions.None);
-                                                string dataTmp = data[0];
-                                                string resultNum = "";
-                                                for (int i = dataTmp.Length - 1; i >= 0; i--)
-                                                {
-                                                    string checkStr = dataTmp.Substring(i, 1);
-                                                    if (function.IsInt(checkStr) || checkStr == ".")
-                                                    {
-                                                        resultNum = checkStr + resultNum;
-                                                    }
-                                                    else
-                                                    {
-                                                        break;
-                                                    }
-                                                }
-                                                decimal Deposit = decimal.Parse(function.CheckNum(resultNum));
-                                                if (Deposit > 0)
-                                                {
-                                                    pos.SeoKeyword = Deposit.ToString();
-                                                }
-                                                else
-                                                {
-                                                    pos.Detail = "1";
-                                                }
-                                            }
-                                            else
-                                            {
-                                                pos.Detail = "1";
-                                            }
+                                            pos.Detail = "1";
                                         }
                                     }
 

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

@@ -484,18 +484,18 @@ namespace MySystem
 
                     //发放开机奖励
                     function.WriteLog("首台" + pos.IsFirst, "开机奖励在激活中监控");
-                    if(pos.IsFirst == 1 && pos.BindingTime > DateTime.Now.AddDays(-CheckDays) && pos.BrandId != 14)
+                    if(pos.IsFirst == 1 && pos.BindingTime > DateTime.Now.AddDays(-CheckDays))
                     {
                         RedisDbconn.Instance.AddList("OpenRewardQueue", pos.Id.ToString());
                     }
                 }
                 //发放大盟主奖励
-                if (pos.LeaderUserId > 0 && pos.IsFirst == 1 && db.Leaders.Any(m => m.Id == pos.LeaderUserId && m.ExpiredDate > now) && pos.BindingTime > DateTime.Now.AddDays(-CheckDays) && pos.BrandId != 14)
+                if (pos.LeaderUserId > 0 && pos.IsFirst == 1 && db.Leaders.Any(m => m.Id == pos.LeaderUserId && m.ExpiredDate > now) && pos.BindingTime > DateTime.Now.AddDays(-CheckDays))
                 {
                     RedisDbconn.Instance.AddList("LeaderPrizeQueue", pos.Id);
                 }
                 //发放运营中心奖励
-                if (pos.IsFirst == 1 && pos.BindingTime > DateTime.Now.AddDays(-CheckDays) && pos.BrandId != 14)
+                if (pos.IsFirst == 1 && pos.BindingTime > DateTime.Now.AddDays(-CheckDays))
                 {
                     RedisDbconn.Instance.AddList("OperatePrizeQueue", pos.Id);
                 }

+ 7 - 6
Startup.cs

@@ -177,12 +177,13 @@ namespace MySystem
                 StatService.Instance.StartActiveReward(); //实时处理激活奖励
                 StatService.Instance.StartActiveReward1(); //实时处理0押激活奖励
                 StatService.Instance.StartActiveReward2(); //实时处理盒易付0押激活奖励
+                StatService.Instance.StartSimActive(); //实时广电卡激活奖励
                 StatService.Instance.StartOpenReward(); //实时获取开机奖励
                 StatService.Instance.ListenFluxRecord(); //实时获取流量费分佣
                 LeaderPrizeService.Instance.Start(); //大盟主奖励发奖
                 OperatePrizeService.Instance.Start(); //运营中心奖励发奖
-                StatService.Instance.StatUserLevel(); //升级
-                ProfitHelperV2.Instance.StatProfit(); //创客分润
+                // StatService.Instance.StatUserLevel(); //升级
+                // ProfitHelperV2.Instance.StatProfit(); //创客分润
                 RedPackageV2Helper.Instance.Start(); //每天生成红包
                 RedPackageV2Helper.Instance.StartStatTop10(); //红包活动统计排行
                 RedPackageV2Helper.Instance.StartSendPrize(); //红包活动发奖
@@ -270,10 +271,10 @@ namespace MySystem
         {
             string conn = Configuration["Setting:SqlConnStr"];
             string dbName = "KxsMainServer";
-            if(Library.ConfigurationManager.EnvironmentFlag == 2)
-            {
-                dbName = "KxsProfitServer";
-            }
+            // if(Library.ConfigurationManager.EnvironmentFlag == 2)
+            // {
+            //     dbName = "KxsProfitServer";
+            // }
             Dictionary<string, Dictionary<string, string>> tables = new Dictionary<string, Dictionary<string, string>>();
             System.Data.DataTable tablecollection = Library.CustomerSqlConn.dtable("select DISTINCT TABLE_NAME from information_schema.columns where table_schema = '" + dbName + "'", conn);
             foreach (System.Data.DataRow subtable in tablecollection.Rows)