Explorar o código

扣8月多余补贴

lichunlei %!s(int64=2) %!d(string=hai) anos
pai
achega
1d970ec27b

+ 8 - 8
AppStart/Helper/SycnSpServer/SycnSpMerchantService.cs

@@ -52,7 +52,7 @@ namespace MySystem
                                     BrandId = 3;
                                 }
                                 if (BrandId == 4 && Mer.Field1 == "200")
-                                { 
+                                {
                                     BrandId = 5;
                                 }
 
@@ -99,13 +99,13 @@ namespace MySystem
                                     }).Entity;
                                     db.SaveChanges();
                                 }
-                                else
-                                {
-                                    string SnNo = add.KqSnNo;
-                                    PxcModels.MachineForMerNo oldPosFor = db.MachineForMerNo.FirstOrDefault(m => m.MerNo == SnNo) ?? new PxcModels.MachineForMerNo();
-                                    PxcModels.PosMachinesTwo oldPos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == oldPosFor.SnId) ?? new PxcModels.PosMachinesTwo();
-                                    pos.IsFirst = oldPos.IsFirst;
-                                }
+                                // else
+                                // {
+                                //     string SnNo = add.KqSnNo;
+                                //     PxcModels.MachineForMerNo oldPosFor = db.MachineForMerNo.FirstOrDefault(m => m.MerNo == SnNo) ?? new PxcModels.MachineForMerNo();
+                                //     PxcModels.PosMachinesTwo oldPos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == oldPosFor.SnId) ?? new PxcModels.PosMachinesTwo();
+                                //     pos.IsFirst = oldPos.IsFirst;
+                                // }
                                 add.UpdateDate = Mer.UpdateTime;
                                 add.TopUserId = TopUserId;
                                 add.BrandId = BrandId;

+ 51 - 1
AppStart/Helper/TestService.cs

@@ -17,7 +17,7 @@ namespace MySystem
 
         public void Start()
         {
-            Thread th = new Thread(resetOpenPrize);
+            Thread th = new Thread(ReduceMoreSubsidy);
             th.IsBackground = true;
             th.Start();
         }
@@ -571,5 +571,55 @@ namespace MySystem
 
         #endregion
     
+
+        #region 扣8月多余补贴
+
+        public void ReduceMoreSubsidy()
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["Pxc1SqlConnStr"].ToString();
+            DataTable dt = OtherMySqlConn.dtable("select UserId,sum(MoreMoney) from SubsidyCheck where Status=0 group by UserId");
+            foreach(DataRow dr in dt.Rows)
+            {
+                int UserId = int.Parse(function.CheckInt(dr["UserId"].ToString()));
+                decimal MoreMoney = decimal.Parse(function.CheckNum(dr[1].ToString()));
+                UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == UserId);
+                if (account != null)
+                {
+                    if(account.BalanceAmount >= MoreMoney)
+                    {
+                        decimal BeforeTotalAmount = account.TotalAmount; //变更前总金额
+                        decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
+                        decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
+                        account.BalanceAmount -= MoreMoney;
+                        decimal AfterTotalAmount = account.TotalAmount; //变更后总金额
+                        decimal AfterFreezeAmount = account.FreezeAmount; //变更后冻结金额
+                        decimal AfterBalanceAmount = account.BalanceAmount; //变更后余额
+                        db.SaveChanges();
+                        UserAccountRecord accountRecord = db.UserAccountRecord.Add(new UserAccountRecord()
+                        {
+                            CreateDate = DateTime.Now,
+                            UpdateDate = DateTime.Now,
+                            UserId = UserId, //创客
+                            ChangeType = 63, //变动类型
+                            ChangeAmount = MoreMoney, //变更金额
+                            BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
+                            AfterTotalAmount = AfterTotalAmount, //变更后总金额
+                            BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
+                            AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
+                            BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
+                            AfterBalanceAmount = AfterBalanceAmount, //变更后余额
+                            Remark = "9月多发补贴扣减",
+                        }).Entity;
+                        db.SaveChanges();
+                        OtherMySqlConn.op("update SubsidyCheck set Status=1 where UserId=" + UserId);
+                    }
+                }
+            }
+            db.Dispose();
+        }
+
+        #endregion
+
     }
 }

+ 1 - 1
Controllers/HomeController.cs

@@ -1287,7 +1287,7 @@ namespace MySystem.Controllers
     
         public string setdeposit()
         {
-            string content = function.GetWebRequest("http://connect.kexiaoshuang.com/home/setfee?merNo=M900065131JVMYUBl5&sn=00000320JBNL01471793&fee=0.63");
+            string content = function.GetWebRequest("http://connect.kexiaoshuang.com/home/setfee?merNo=M700065131Hjo76n28&sn=00003102722201179801666&fee=0.63");
             return content;
         }