浏览代码

增加广电卡激活逻辑,并发开户奖30

lcl 1 年之前
父节点
当前提交
9115abc1fc

+ 7 - 3
AppStart/Helper/AlipayPayBack2Service.cs

@@ -125,7 +125,7 @@ namespace MySystem
                         pro.ProductId = order.ProductId;
                     }
                     List<int> couponIds = new List<int>();
-                    if (pro.ProductId == 10 || pro.ProductId == 11 || pro.ProductId == 27 || pro.ProductId == 28 || pro.ProductId == 34 || pro.ProductId == -2)
+                    if (pro.ProductId == 10 || pro.ProductId == 11 || pro.ProductId == 80 || pro.ProductId == 27 || pro.ProductId == 28 || pro.ProductId == 34 || pro.ProductId == -2)
                     {
                         order.Status = 2;
                         int BuyCount = pro.ProductCount;
@@ -139,6 +139,10 @@ namespace MySystem
                         {
                             Kind = 2;
                         }
+                        else if (pro.ProductId == 80)
+                        {
+                            Kind = 3;
+                        }
                         else if (pro.ProductId == 28)
                         {
                             Users user = db.Users.FirstOrDefault(m => m.Id == order.UserId && m.LeaderLevel == 0);
@@ -157,11 +161,11 @@ namespace MySystem
                                 user.LeaderLevel = 2;
                             }
                         }
-                        if(Kind <= 2 && (pro.ProductId == 10 || pro.ProductId == 11 || pro.ProductId == 34 || pro.ProductId == -2))
+                        if(Kind <= 3 && (pro.ProductId == 10 || pro.ProductId == 11 || pro.ProductId == 80 || pro.ProductId == 34 || pro.ProductId == -2))
                         {
                             // 购买600一组机具券,返券
                             int CouponCount = 0;
-                            if(Kind == 1)
+                            if(Kind == 1 || Kind == 3)
                             {
                                 CouponCount = 3 * pro.ProductCount;
                             }

+ 4 - 0
AppStart/Helper/StatService.cs

@@ -411,6 +411,10 @@ namespace MySystem
                         {
                             doActiveReward(db, merchant, pos, GetUserId, ParentNav, TopUserId, 50);
                         }
+                        else if(pos.BrandId == 14)
+                        {
+                            doActiveReward(db, merchant, pos, GetUserId, ParentNav, TopUserId, 30);
+                        }
                         else
                         {
                             //金控活动机返奖励

+ 38 - 25
AppStart/Helper/SycnSpServer/SycnSpTradeService.cs

@@ -133,6 +133,7 @@ namespace MySystem
                             PxcModels.PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == posFor.SnId);
                             if (pos != null)
                             {
+                                PxcModels.KqProducts brand = db.KqProducts.FirstOrDefault(m => m.Id == pos.BrandId) ?? new PxcModels.KqProducts();
                                 if (pos.BindMerchantId > 0)
                                 {
                                     PxcModels.Users user = db.Users.FirstOrDefault(m => m.Id == pos.UserId) ?? new PxcModels.Users();
@@ -295,7 +296,7 @@ namespace MySystem
                                                 pos.Sort = 1;
                                             }
                                         }
-                                        decimal CheckMoney = 1000;
+                                        decimal CheckMoney = brand.ActTradeAmount > 0 ? brand.ActTradeAmount : 1000;
                                         int CheckDays = 30;
                                         //联动
                                         if(BankCardType == 1 && trade.TradeType == "M015" && (pos.BrandId == 10 || pos.BrandId == 11))
@@ -332,6 +333,11 @@ namespace MySystem
                                         {
                                             pos.CreditTrade += SourceTradeAmount;
                                         }
+                                        //广电卡
+                                        else if(pos.BrandId == 14)
+                                        {
+                                            pos.CreditTrade += SourceTradeAmount;
+                                        }
                                         else if (BankCardType == 0)
                                         {
                                             pos.DebitCardTrade += TradeAmount;
@@ -350,30 +356,37 @@ namespace MySystem
                                                 merchant.ActiveStatus = 1;
                                                 merchant.MerStandardDate = DateTime.Now;
                                                 db.SaveChanges();
-                                                function.WriteLog("商户" + merchant.KqMerNo, "开机奖励在激活中监控");
 
-                                                // 推荐王逻辑(激活)
-                                                string SendData = "{\"Kind\":\"3\",\"Data\":{\"UserId\":\"" + pos.BuyUserId + "\",\"PosId\":\"" + pos.Id + "\",\"TradeMonth\":\"" + DateTime.Now.ToString("yyyyMM") + "\"}}";
-                                                RedisDbconn.Instance.AddList("RecommendActStatQueue", SendData);
-
-                                                //发放开机奖励
-                                                function.WriteLog("首台" + pos.IsFirst, "开机奖励在激活中监控");
-                                                if(pos.IsFirst == 1 && pos.BindingTime > DateTime.Now.AddDays(-CheckDays))
+                                                if(pos.BrandId != 14)
                                                 {
-                                                    RedisDbconn.Instance.AddList("OpenRewardQueue", pos.Id.ToString());
+                                                    function.WriteLog("商户" + merchant.KqMerNo, "开机奖励在激活中监控");
+
+                                                    // 推荐王逻辑(激活)
+                                                    // string SendData = "{\"Kind\":\"3\",\"Data\":{\"UserId\":\"" + pos.BuyUserId + "\",\"PosId\":\"" + pos.Id + "\",\"TradeMonth\":\"" + DateTime.Now.ToString("yyyyMM") + "\"}}";
+                                                    // RedisDbconn.Instance.AddList("RecommendActStatQueue", SendData);
+
+                                                    //发放开机奖励
+                                                    function.WriteLog("首台" + pos.IsFirst, "开机奖励在激活中监控");
+                                                    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))
-                                            {
-                                                RedisDbconn.Instance.AddList("LeaderPrizeQueue", pos.Id);
-                                            }
-                                            //发放运营中心奖励
-                                            if(pos.IsFirst == 1 && pos.BindingTime > DateTime.Now.AddDays(-CheckDays))
+                                            if(pos.BrandId != 14)
                                             {
-                                                RedisDbconn.Instance.AddList("OperatePrizeQueue", pos.Id);
+                                                //发放大盟主奖励
+                                                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))
+                                                {
+                                                    RedisDbconn.Instance.AddList("OperatePrizeQueue", pos.Id);
+                                                }
+                                                AlipayPayBack2Service.Instance.ActReserveBack(pos.OpId, pos.OpReserve1, pos.OpReserve2, pos.OpReserve3);
                                             }
-                                            AlipayPayBack2Service.Instance.ActReserveBack(pos.OpId, pos.OpReserve1, pos.OpReserve2, pos.OpReserve3);
 
                                             //统计激活数
                                             RedisDbconn.Instance.AddList("StatActQueue", "{\"TradeDate\":\"" + DateTime.Now.ToString("yyyyMMdd") + "\",\"UserId\":\"" + pos.BuyUserId + "\",\"BrandId\":\"" + pos.BrandId + "\"}");
@@ -386,7 +399,7 @@ namespace MySystem
                                             {
                                                 MerHelpFlag = 2;
                                             }
-                                            else if (DepositAmt > 0 && pos.IsFirst == 1)
+                                            else if ((DepositAmt > 0 && pos.IsFirst == 1) || pos.BrandId == 14)
                                             {
                                                 string DayString = RedisDbconn.Instance.Get<string>("pobjrule:" + pos.BrandId + ":HelpPolicy:Days");
                                                 int Days = int.Parse(DayString); //天数
@@ -471,11 +484,11 @@ namespace MySystem
                                         db.SaveChanges();
 
                                         // 推荐王逻辑(交易)
-                                        if(TradeAmount > 0)
-                                        {
-                                            string Send = "{\"Kind\":\"4\",\"Data\":{\"PosId\":\"" + pos.Id + "\",\"TradeMonth\":\"" + trade.CreateDate.Value.ToString("yyyyMM") + "\",\"TradeAmount\":\"" + TradeAmount + "\"}}";
-                                            RedisDbconn.Instance.AddList("RecommendActStatQueue", Send);
-                                        }
+                                        // if(TradeAmount > 0)
+                                        // {
+                                        //     string Send = "{\"Kind\":\"4\",\"Data\":{\"PosId\":\"" + pos.Id + "\",\"TradeMonth\":\"" + trade.CreateDate.Value.ToString("yyyyMM") + "\",\"TradeAmount\":\"" + TradeAmount + "\"}}";
+                                        //     RedisDbconn.Instance.AddList("RecommendActStatQueue", Send);
+                                        // }
                                     }
                                     TradeRecord edit = spdb.TradeRecord.FirstOrDefault(m => m.Id == trade.Id);
                                     if (edit != null)

+ 31 - 20
Startup.cs

@@ -95,26 +95,6 @@ namespace MySystem
             MySystemLib.SystemPublicFuction.appid = appid;
             MySystemLib.SystemPublicFuction.checkurl = checkurl;
             MySystemLib.SystemPublicFuction.appcheck = "success";
-            string conn = Configuration["Setting:SqlConnStr"];
-            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 = 'KxsProfitServer'", conn);
-            foreach (System.Data.DataRow subtable in tablecollection.Rows)
-            {
-                Dictionary<string, string> Columns = new Dictionary<string, string>();
-                System.Data.DataTable columncollection = Library.CustomerSqlConn.dtable("select COLUMN_NAME,DATA_TYPE from information_schema.columns where table_schema = 'KxsProfitServer' and TABLE_NAME='" + subtable["TABLE_NAME"].ToString() + "'", conn);
-                foreach (System.Data.DataRow column in columncollection.Rows)
-                {
-                    string datatype = column["DATA_TYPE"].ToString();
-                    if (datatype == "decimal")
-                    {
-                        datatype = "numeric";
-                    }
-                    Columns.Add(column["COLUMN_NAME"].ToString(), datatype);
-                }
-                tables.Add(subtable["TABLE_NAME"].ToString(), Columns);
-            }
-            MySystemLib.SystemPublicFuction.dbtables = tables;
-
             RedisDbconn.csredis = new CSRedis.CSRedisClient(Configuration["Setting:RedisConnStr"]);
         }
 
@@ -178,9 +158,12 @@ namespace MySystem
                     pattern: "{controller=Home}/{action=Index}/{Id?}");
             });
 
+            InitMain();
+
             //必须打开的
             if(Library.ConfigurationManager.EnvironmentFlag == 1)
             {
+                StatService.Instance.StartActiveReward1(); //实时处理激活奖励
             }
             if(Library.ConfigurationManager.EnvironmentFlag == 2)
             {
@@ -283,5 +266,33 @@ namespace MySystem
             // TimedTaskHelper.Instance.Start();
             // TaskFlowHelper.Instance.Start();
         }
+
+        private void InitMain()
+        {
+            string conn = Configuration["Setting:SqlConnStr"];
+            string dbName = "KxsMainServer";
+            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)
+            {
+                Dictionary<string, string> Columns = new Dictionary<string, string>();
+                System.Data.DataTable columncollection = Library.CustomerSqlConn.dtable("select COLUMN_NAME,DATA_TYPE from information_schema.columns where table_schema = '" + dbName + "' and TABLE_NAME='" + subtable["TABLE_NAME"].ToString() + "'", conn);
+                foreach (System.Data.DataRow column in columncollection.Rows)
+                {
+                    string datatype = column["DATA_TYPE"].ToString();
+                    if (datatype == "decimal")
+                    {
+                        datatype = "numeric";
+                    }
+                    Columns.Add(column["COLUMN_NAME"].ToString(), datatype);
+                }
+                tables.Add(subtable["TABLE_NAME"].ToString(), Columns);
+            }
+            MySystemLib.SystemPublicFuction.dbtables = tables;
+        }
     }
 }