Browse Source

修复100直推奖励

lichunlei 3 years ago
parent
commit
ecefc72b59

+ 1 - 1
AppStart/Helper/AlipayPayBack2Service.cs

@@ -175,7 +175,7 @@ namespace MySystem
                             //推荐下单奖励
                             if (pro.ProductId == 10 || pro.ProductId == 11)
                             {
-                                int SelfBuy = db.OrderProduct.Count(m => m.UserId == order.UserId && m.OrderId != OrderId && (m.ProductId == 10 || m.ProductId == 11));
+                                int SelfBuy = db.OrderProduct.Count(m => m.UserId == order.UserId && (m.ProductId == 10 || m.ProductId == 11));
                                 if (SelfBuy == 1)
                                 {
                                     Users user = db.Users.FirstOrDefault(m => m.Id == order.UserId);

+ 64 - 0
Controllers/HomeController.cs

@@ -429,6 +429,70 @@ namespace MySystem.Controllers
             return "ok";
         }
 
+        // public string add100()
+        // {
+        //     WebCMSEntities db = new WebCMSEntities();
+        //     List<int> uids = new List<int>();
+        //     uids.Add(1053);
+        //     foreach (int uid in uids)
+        //     {
+        //         int ParentUserId = uid;
+        //         int machineCount = db.PosMachinesTwo.Count(m => m.UserId == ParentUserId && m.PosSnType == 0); //判断是否拥有3台购买机
+        //         int ActiveCount = db.PosMachinesTwo.Count(m => m.UserId == ParentUserId && m.ActivationState == 1); //判断是否拥有3台激活机(不限购买或赠送)
+        //         if (machineCount + ActiveCount >= 3)
+        //         {
+        //             UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == ParentUserId);
+        //             if (account == null)
+        //             {
+        //                 account = db.UserAccount.Add(new UserAccount()
+        //                 {
+        //                     Id = ParentUserId,
+        //                     UserId = ParentUserId,
+        //                 }).Entity;
+        //                 db.SaveChanges();
+        //             }
+        //             decimal BeforeTotalAmount = account.TotalAmount; //变更前总金额
+        //             decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
+        //             decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
+        //             account.BalanceAmount += 100;
+        //             account.TotalAmount += 100;
+        //             decimal AfterTotalAmount = account.TotalAmount; //变更后总金额
+        //             decimal AfterFreezeAmount = account.FreezeAmount; //变更后冻结金额
+        //             decimal AfterBalanceAmount = account.BalanceAmount; //变更后余额
+        //             UserAccountRecord userAccountRecord = db.UserAccountRecord.Add(new UserAccountRecord()
+        //             {
+        //                 CreateDate = DateTime.Now,
+        //                 UpdateDate = DateTime.Now,
+        //                 UserId = ParentUserId, //创客
+        //                 ChangeType = 112, //变动类型
+        //                 ChangeAmount = 100, //变更金额
+        //                 BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
+        //                 AfterTotalAmount = AfterTotalAmount, //变更后总金额
+        //                 BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
+        //                 AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
+        //                 BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
+        //                 AfterBalanceAmount = AfterBalanceAmount, //变更后余额
+        //             }).Entity;
+        //             db.SaveChanges();
+        //             RedisDbconn.Instance.Set("UserAccount:" + ParentUserId, account);
+
+        //             //推荐下单上级获得30天的机具循环天数
+        //             var posList = db.PosMachinesTwo.Select(m => new { m.Id, m.UserId, m.BindingState, m.RecycEndDate }).Where(m => m.UserId == ParentUserId && m.BindingState == 0 && m.RecycEndDate != null).ToList();
+        //             foreach (var subPos in posList)
+        //             {
+        //                 PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == subPos.Id);
+        //                 if (pos != null)
+        //                 {
+        //                     pos.RecycEndDate = pos.RecycEndDate.Value.AddDays(30);
+        //                 }
+        //             }
+        //             db.SaveChanges();
+        //         }
+        //     }
+        //     db.Dispose();
+        //     return "finish";
+        // }
+
         public string test()
         {
             // StatService.Instance.dosomething2("2022-03-31");

+ 7 - 7
Startup.cs

@@ -89,10 +89,10 @@ namespace MySystem
             // services.AddHostedService<TeamTopService>();
             // services.AddHostedService<PopService>();
             
-            services.AddHostedService<TimerStatTimer>(); //实时统计创客、激活商户数
-            services.AddHostedService<PosTradeStatTimer>(); // 统计头天的交易额、商户型创客、激活奖励、开机奖励
-            services.AddHostedService<SycnSpTimer>(); //同步SP数据
-            services.AddHostedService<AlipayPayBack2Timer>(); //支付宝回调处理
+            // services.AddHostedService<TimerStatTimer>(); //实时统计创客、激活商户数
+            // services.AddHostedService<PosTradeStatTimer>(); // 统计头天的交易额、商户型创客、激活奖励、开机奖励
+            // services.AddHostedService<SycnSpTimer>(); //同步SP数据
+            // services.AddHostedService<AlipayPayBack2Timer>(); //支付宝回调处理
 
             //services.AddHttpContextAccessor();
 
@@ -216,12 +216,12 @@ namespace MySystem
 
             // app.UseMiddleware<GraphQLMiddleware>();
 
-            ActiveRewardTimer.Instance.Start(); //实时处理激活记录
-            TradeStatTimer.Instance.Start(); //交易统计
+            // ActiveRewardTimer.Instance.Start(); //实时处理激活记录
+            // TradeStatTimer.Instance.Start(); //交易统计
             // ProfitHelper.Instance.StatProfit("202203");
 
             //当前必须打开的
-            RabbitMQClient.Instance.StartReceive("MakeReferenceQrCode");
+            // RabbitMQClient.Instance.StartReceive("MakeReferenceQrCode");
 
             // RabbitMQClient.Instance.StartReceive("MerchantConfirmList");
             // RabbitMQClient.Instance.StartReceive("CheckWeChatSign");

+ 3 - 3
appsettings.json

@@ -17,9 +17,9 @@
     "Host": "http://localhost:5047/",
     "SourceHost": "http://bs.kexiaoshuang.com/",
     "Database": "KxsMainServer",
-    "SqlConnStr": "server=localhost;port=3306;user=KxsMainServer;password=Rw2imhXQQt5ODWIF;database=KxsMainServer;charset=utf8;",
-    "Pxc1SqlConnStr": "server=localhost;port=3306;user=KxsMainServer;password=Rw2imhXQQt5ODWIF;database=KxsMainServer;charset=utf8;",
-    "SpSqlConnStr": "server=localhost;port=3306;user=KxsSpServer;password=jJ9qKsvwWgQA9xWG;database=KxsSpServer;charset=utf8;",
+    "SqlConnStr": "server=47.108.231.170;port=3306;user=KxsMainServer;password=Rw2imhXQQt5ODWIF;database=KxsMainServer;charset=utf8;",
+    "Pxc1SqlConnStr": "server=47.108.231.170;port=3306;user=KxsMainServer;password=Rw2imhXQQt5ODWIF;database=KxsMainServer;charset=utf8;",
+    "SpSqlConnStr": "server=47.108.229.115;port=3306;user=KxsSpServer;password=jJ9qKsvwWgQA9xWG;database=KxsSpServer;charset=utf8;",
     "RedisConnStr": "47.108.207.184:6379,password=skb@redis2022,DefaultDatabase=0,poolsize=500,preheat=50,asyncPipeline=true",
     "TendisConnStr": "47.108.207.184:51002,password=HDlNs1ZpG5iR9D9I,DefaultDatabase=0,poolsize=500,preheat=50,asyncPipeline=true",
     "IOSAppVersion": "1.0.0",

BIN
bin/Debug/netcoreapp3.0/MySystem.dll


BIN
bin/Debug/netcoreapp3.0/MySystem.pdb


+ 3 - 3
bin/Debug/netcoreapp3.0/appsettings.json

@@ -17,9 +17,9 @@
     "Host": "http://localhost:5047/",
     "SourceHost": "http://bs.kexiaoshuang.com/",
     "Database": "KxsMainServer",
-    "SqlConnStr": "server=localhost;port=3306;user=KxsMainServer;password=Rw2imhXQQt5ODWIF;database=KxsMainServer;charset=utf8;",
-    "Pxc1SqlConnStr": "server=localhost;port=3306;user=KxsMainServer;password=Rw2imhXQQt5ODWIF;database=KxsMainServer;charset=utf8;",
-    "SpSqlConnStr": "server=localhost;port=3306;user=KxsSpServer;password=jJ9qKsvwWgQA9xWG;database=KxsSpServer;charset=utf8;",
+    "SqlConnStr": "server=47.108.231.170;port=3306;user=KxsMainServer;password=Rw2imhXQQt5ODWIF;database=KxsMainServer;charset=utf8;",
+    "Pxc1SqlConnStr": "server=47.108.231.170;port=3306;user=KxsMainServer;password=Rw2imhXQQt5ODWIF;database=KxsMainServer;charset=utf8;",
+    "SpSqlConnStr": "server=47.108.229.115;port=3306;user=KxsSpServer;password=jJ9qKsvwWgQA9xWG;database=KxsSpServer;charset=utf8;",
     "RedisConnStr": "47.108.207.184:6379,password=skb@redis2022,DefaultDatabase=0,poolsize=500,preheat=50,asyncPipeline=true",
     "TendisConnStr": "47.108.207.184:51002,password=HDlNs1ZpG5iR9D9I,DefaultDatabase=0,poolsize=500,preheat=50,asyncPipeline=true",
     "IOSAppVersion": "1.0.0",

BIN
bin/release/netcoreapp3.0/MySystem.dll


BIN
bin/release/netcoreapp3.0/MySystem.pdb


BIN
obj/Debug/netcoreapp3.0/MySystem.dll


BIN
obj/Debug/netcoreapp3.0/MySystem.pdb


BIN
obj/release/netcoreapp3.0/MySystem.dll


BIN
obj/release/netcoreapp3.0/MySystem.pdb