浏览代码

广电卡的奖励调整,激活奖励、开机奖励、大盟主奖励、运营中心奖励

lcl 1 年之前
父节点
当前提交
b09c05f0c8

+ 8 - 3
AppStart/Helper/LeaderPrizeService.cs

@@ -36,6 +36,11 @@ namespace MySystem
                         PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == PosId);
                         if (pos != null)
                         {
+                            decimal ChangeAmount = 10;
+                            if(pos.BrandId == 14)
+                            {
+                                ChangeAmount = decimal.Parse(function.CheckNum(pos.SeoKeyword)) * 0.15M;
+                            }
                             int LeaderUserId = pos.LeaderUserId;
                             UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == LeaderUserId);
                             if (account == null)
@@ -50,8 +55,8 @@ namespace MySystem
                             decimal BeforeTotalAmount = account.TotalAmount; //变更前总金额
                             decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
                             decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
-                            account.BalanceAmount += 10;
-                            account.TotalAmount += 10;
+                            account.BalanceAmount += ChangeAmount;
+                            account.TotalAmount += ChangeAmount;
                             decimal AfterTotalAmount = account.TotalAmount; //变更后总金额
                             decimal AfterFreezeAmount = account.FreezeAmount; //变更后冻结金额
                             decimal AfterBalanceAmount = account.BalanceAmount; //变更后余额
@@ -61,7 +66,7 @@ namespace MySystem
                                 UpdateDate = DateTime.Now,
                                 UserId = LeaderUserId, //创客
                                 ChangeType = 116, //变动类型
-                                ChangeAmount = 10, //变更金额
+                                ChangeAmount = ChangeAmount, //变更金额
                                 BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
                                 AfterTotalAmount = AfterTotalAmount, //变更后总金额
                                 BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额

+ 8 - 3
AppStart/Helper/OperatePrizeService.cs

@@ -60,6 +60,11 @@ namespace MySystem
                             }
                             if(OpId > 0)
                             {
+                                decimal ChangeAmount = 5;
+                                if(pos.BrandId == 14)
+                                {
+                                    ChangeAmount = decimal.Parse(function.CheckNum(pos.SeoKeyword)) * 0.05M;
+                                }
                                 UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == OpId);
                                 if (account == null)
                                 {
@@ -73,8 +78,8 @@ namespace MySystem
                                 decimal BeforeTotalAmount = account.TotalAmount; //变更前总金额
                                 decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
                                 decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
-                                account.BalanceAmount += 5;
-                                account.TotalAmount += 5;
+                                account.BalanceAmount += ChangeAmount;
+                                account.TotalAmount += ChangeAmount;
                                 decimal AfterTotalAmount = account.TotalAmount; //变更后总金额
                                 decimal AfterFreezeAmount = account.FreezeAmount; //变更后冻结金额
                                 decimal AfterBalanceAmount = account.BalanceAmount; //变更后余额
@@ -84,7 +89,7 @@ namespace MySystem
                                     UpdateDate = DateTime.Now,
                                     UserId = OpId, //创客
                                     ChangeType = 121, //变动类型
-                                    ChangeAmount = 5, //变更金额
+                                    ChangeAmount = ChangeAmount, //变更金额
                                     BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
                                     AfterTotalAmount = AfterTotalAmount, //变更后总金额
                                     BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额

+ 24 - 17
AppStart/Helper/StatService.cs

@@ -316,21 +316,28 @@ namespace MySystem
                         }
                         if (ActPrize > 0)
                         {
-                            if (ActPrize == 99)
+                            if(pos.BrandId == 14)
                             {
-                                ActPrize = 100;
+                                ActPrize = ActPrize * 1.5M;
                             }
-                            else if (ActPrize == 199)
+                            else
                             {
-                                ActPrize = 200;
-                            }
-                            else if (ActPrize == 299)
-                            {
-                                ActPrize = 300;
-                            }
-                            else if (ActPrize == 249)
-                            {
-                                ActPrize = 260;
+                                if (ActPrize == 99)
+                                {
+                                    ActPrize = 100;
+                                }
+                                else if (ActPrize == 199)
+                                {
+                                    ActPrize = 200;
+                                }
+                                else if (ActPrize == 299)
+                                {
+                                    ActPrize = 300;
+                                }
+                                else if (ActPrize == 249)
+                                {
+                                    ActPrize = 260;
+                                }
                             }
                             if (GetUserId > 0)
                             {
@@ -411,10 +418,6 @@ namespace MySystem
                         {
                             doActiveReward(db, merchant, pos, GetUserId, ParentNav, TopUserId, 50);
                         }
-                        else if(pos.BrandId == 14)
-                        {
-                            // doActiveReward(db, merchant, pos, GetUserId, ParentNav, TopUserId, 30);
-                        }
                         else
                         {
                             //金控活动机返奖励
@@ -1071,7 +1074,7 @@ namespace MySystem
                         int PosId = int.Parse(content);
                         Thread.Sleep(1000);
                         WebCMSEntities db = new WebCMSEntities();
-                        PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == PosId && m.ActivationState == 1 && !string.IsNullOrEmpty(m.SeoKeyword) && m.SeoKeyword != "0" && m.CreditTrade >= 1000);
+                        PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == PosId && m.ActivationState == 1 && !string.IsNullOrEmpty(m.SeoKeyword) && m.SeoKeyword != "0" && (m.CreditTrade >= 1000 || m.BrandId == 14));
                         if (pos != null)
                         {
                             function.WriteLog("sn:" + pos.PosSn, "开机奖励发放日志");
@@ -1093,6 +1096,10 @@ namespace MySystem
                                             if (!string.IsNullOrEmpty(ParentNav))
                                             {
                                                 decimal Prize = 20;
+                                                if(pos.BrandId == 14)
+                                                {
+                                                    Prize = ActPrize * 0.3M;
+                                                }
                                                 string[] ParentNavs = ParentNav.Trim(',').Replace(",,", ",").Split(',');
                                                 for (int i = ParentNavs.Length - 1; i >= 0; i--)
                                                 {

+ 39 - 2
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.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 }).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();
@@ -93,10 +93,47 @@ namespace MySystem
                                     pos.BindingState = 1;
                                     pos.BindingTime = Bind.CreateTime;
                                     pos.Status = 0;
-                                    if(pos.BrandId == 14 && Bind.Field3 == "副卡")
+
+                                    //广电卡逻辑
+                                    if (pos.BrandId == 14 && (Bind.Field2.Contains("副卡") || Bind.Field3.Contains("副卡")))
                                     {
                                         pos.Detail = "1";
                                     }
+                                    else
+                                    {
+                                        if (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";
+                                        }
+                                    }
+
                                     PxcModels.MachineForMerNo merFor = db.MachineForMerNo.FirstOrDefault(m => m.MerNo == Bind.MerNo);
                                     if (merFor == null)
                                     {

+ 15 - 26
AppStart/Helper/SycnSpServer/SycnSpTradeService.cs

@@ -469,7 +469,6 @@ namespace MySystem
             DateTime now = DateTime.Now;
             DateTime TransferTime = pos.TransferTime == null ? DateTime.Now : pos.TransferTime.Value;
             if (pos.CreditTrade >= CheckMoney && pos.BuyUserId > 0 && pos.ActivationState == 0 && TransferTime.AddMinutes(-30) < pos.BindingTime)
-            // if (pos.CreditTrade >= CheckMoney && pos.ActivationState == 0 && TransferTime < pos.BindingTime && pos.BindingTime > DateTime.Now.AddDays(-CheckDays))
             {
                 pos.ActivationState = 1;
                 pos.ActivationTime = DateTime.Now;
@@ -481,36 +480,26 @@ namespace MySystem
                     merchant.MerStandardDate = DateTime.Now;
                     db.SaveChanges();
 
-                    if(pos.BrandId != 14)
-                    {
-                        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("商户" + merchant.KqMerNo, "开机奖励在激活中监控");
 
-                        //发放开机奖励
-                        function.WriteLog("首台" + pos.IsFirst, "开机奖励在激活中监控");
-                        if(pos.IsFirst == 1 && pos.BindingTime > DateTime.Now.AddDays(-CheckDays))
-                        {
-                            RedisDbconn.Instance.AddList("OpenRewardQueue", pos.Id.ToString());
-                        }
+                    //发放开机奖励
+                    function.WriteLog("首台" + pos.IsFirst, "开机奖励在激活中监控");
+                    if(pos.IsFirst == 1 && pos.BindingTime > DateTime.Now.AddDays(-CheckDays))
+                    {
+                        RedisDbconn.Instance.AddList("OpenRewardQueue", pos.Id.ToString());
                     }
                 }
-                if(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))
                 {
-                    //发放大盟主奖励
-                    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);
+                    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);
 
                 //统计激活数
                 RedisDbconn.Instance.AddList("StatActQueue", "{\"TradeDate\":\"" + DateTime.Now.ToString("yyyyMMdd") + "\",\"UserId\":\"" + pos.BuyUserId + "\",\"BrandId\":\"" + pos.BrandId + "\"}");

+ 9 - 0
Controllers/HomeController.cs

@@ -175,6 +175,14 @@ namespace MySystem.Controllers
             // {
             //     TradeChangeService.Instance.StatTradeAmount(id, 2, 1);
             // }
+
+            WebCMSEntities db = new WebCMSEntities();
+            PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.PosSn == "8610086012" && m.ActivationState == 0 && !string.IsNullOrEmpty(m.SeoKeyword) && m.SeoKeyword != "0" && (m.CreditTrade >= 1000 || m.BrandId == 14));
+            if(pos != null)
+            {
+                SycnSpTradeService.Instance.ActPos(db, pos, 0, 30);
+            }
+            db.Dispose();
             return "ok";
         }
 
@@ -232,6 +240,7 @@ namespace MySystem.Controllers
             //     }
             // }
             // db.Dispose();
+            
             return "ok";
         }
 

+ 4 - 4
appsettings.json

@@ -17,11 +17,11 @@
     "Host": "http://localhost:5047/",
     "SourceHost": "http://bs.kexiaoshuang.com/",
     "Database": "KxsMainServer",
-    "SqlConnStr": "server=47.108.231.170;port=3306;user=KxsMain;password=mzeqjriUWore0dwT;database=KxsMainServer;charset=utf8;",
-    "Pxc1SqlConnStr": "server=47.108.231.170;port=3306;user=KxsMain;password=mzeqjriUWore0dwT;database=KxsMainServer;charset=utf8;",
+    "SqlConnStr": "server=rm-2vcs4j67tla603c9d5o.mysql.cn-chengdu.rds.aliyuncs.com;port=3306;user=KxsProfitServer;password=FrW8ZfxlcaVdm1r0;database=KxsProfitServer;charset=utf8;",
+    "Pxc1SqlConnStr": "server=rm-2vcs4j67tla603c9d5o.mysql.cn-chengdu.rds.aliyuncs.com;port=3306;user=KxsProfitServer;password=FrW8ZfxlcaVdm1r0;database=KxsProfitServer;charset=utf8;",
     "MainSqlConnStr": "server=47.108.231.170;port=3306;user=KxsMain;password=mzeqjriUWore0dwT;database=KxsStatServer;charset=utf8;",
     "SpSqlConnStr": "server=47.108.229.115;port=3306;user=KxsSpServer;password=jJ9qKsvwWgQA9xWG;database=KxsSpServer;charset=utf8;",
-    "OpSqlConnStr": "server=47.108.231.170;port=3306;user=KxsOpServer;password=r7jwZ8ydLoeswDR4;database=KxsOpServer;charset=utf8;",
+    "OpSqlConnStr": "server=rm-2vcs4j67tla603c9d5o.mysql.cn-chengdu.rds.aliyuncs.com;port=3306;user=KxsProfitServer;password=FrW8ZfxlcaVdm1r0;database=KxsOpServer;charset=utf8;",
     "MpSqlConnStr": "server=rm-2vc27k81v217qs1t55o.mysql.cn-chengdu.rds.aliyuncs.com;port=3306;user=QrCodePlateMainServer;password=ll4DFaALMu9YIooM;database=QrCodePlateMainServer;charset=utf8;",
     "RdsStatSqlConnStr": "server=rm-2vc27k81v217qs1t55o.mysql.cn-chengdu.rds.aliyuncs.com;port=3306;user=KxsStatServer;password=mzeqjriUWore0dwT;database=KxsStatServer;charset=utf8;",
     "RedisConnStr": "47.108.207.184:6379,password=skb@redis2022,DefaultDatabase=0,poolsize=500,preheat=50,asyncPipeline=true",
@@ -37,6 +37,6 @@
     "JwtAud": "api",
     "MqUserName": "skb@rabbitmq",
     "MqPassword": "skb@rabbitmq",
-    "MqHostName": "47.108.231.170:5672,47.108.225.92:5672"
+    "MqHostName": "192.168.0.121:5672,192.168.0.122:5672"
   }
 }