DuGuYang 3 лет назад
Родитель
Сommit
e11fc4eef6

+ 19 - 22
Areas/Admin/Controllers/MainServer/StoreHouseController.cs

@@ -1696,24 +1696,30 @@ namespace MySystem.Areas.Admin.Controllers
                                         posInfo.OpId = sysAdmin.UserId;
                                         if (userAmount.ValidAmount - amount >= 0)
                                         {
-                                            posInfo.OpReserveKind = 3;//标记为关联分仓额度
                                             userAmount.ValidAmount -= amount;
+                                            posInfo.OpReserve3 += amount;
+                                            posInfo.OpReserve1 = 0;
+                                            posInfo.OpReserve2 = 0;
                                             opdb.SaveChanges();
                                         }
                                         else
                                         {
                                             if (userAmount.TotalAmt - amount >= 0)
                                             {
-                                                posInfo.OpReserveKind = 1;//标记为未使用额度
-                                                userAmount.TotalAmt -= amount;
+                                                userAmount.TotalAmt -= amount - userAmount.ValidAmount;
+                                                posInfo.OpReserve3 = userAmount.ValidAmount;
+                                                posInfo.OpReserve1 = amount - userAmount.ValidAmount;
+                                                posInfo.OpReserve2 = 0;
                                                 opdb.SaveChanges();
                                             }
                                             else
                                             {
                                                 if (userAmount.ValidForGetAmount - amount >= 0)
                                                 {
-                                                    posInfo.OpReserveKind = 2;//标记为可提现额度
-                                                    userAmount.ValidForGetAmount -= amount;
+                                                    userAmount.ValidForGetAmount -= amount - userAmount.TotalAmt;
+                                                    posInfo.OpReserve3 = 0;
+                                                    posInfo.OpReserve1 = userAmount.TotalAmt;
+                                                    posInfo.OpReserve2 = amount - userAmount.TotalAmt;
                                                     opdb.SaveChanges();
                                                 }
                                             }
@@ -1768,7 +1774,7 @@ namespace MySystem.Areas.Admin.Controllers
                                     OperateType = 1,
                                     UseAmount = deposit - tamount,
                                     BeforeAmount = TotalAmount,
-                                    AfterAmount = TotalAmount + deposit- tamount,
+                                    AfterAmount = TotalAmount + deposit - tamount,
                                 }).Entity;
                             }
                             if (deposit < tamount)
@@ -1919,22 +1925,13 @@ namespace MySystem.Areas.Admin.Controllers
                             foreach (var items in pos)
                             {
                                 var posInfo = db.PosMachinesTwo.FirstOrDefault(m => m.Id == items.Id) ?? new PosMachinesTwo();
-                                if (posInfo.OpReserveKind == 3)
-                                {
-                                    userAmount.ValidAmount += amount;//标记为关联分仓额度
-                                    opdb.SaveChanges();
-                                }
-                                if (posInfo.OpReserveKind == 1)
-                                {
-                                    userAmount.TotalAmt += amount;//标记为未使用额度
-                                    opdb.SaveChanges();
-                                }
-                                if (posInfo.OpReserveKind == 2)
-                                {
-                                    userAmount.ValidForGetAmount += amount;//标记为可提现额度
-                                    opdb.SaveChanges();
-                                }
-                                posInfo.OpReserveKind = 0;
+                                userAmount.ValidAmount += posInfo.OpReserve3;
+                                userAmount.TotalAmt += posInfo.OpReserve1;
+                                userAmount.ValidForGetAmount += posInfo.OpReserve2;
+                                posInfo.OpReserve3 = 0;
+                                posInfo.OpReserve1 = 0;
+                                posInfo.OpReserve2 = 0;
+                                opdb.SaveChanges();
                                 db.SaveChanges();
                             }
                             tamount += amount * posCount;//扣减运营中心该品牌机具额度

+ 40 - 13
Areas/Admin/Controllers/OperateServer/StoreMachineApplyOperateController.cs

@@ -404,8 +404,8 @@ namespace MySystem.Areas.Admin.Controllers
                         CreateMan = SysUserName + "-" + SysRealName,
                         SeoDescription = "机具申请驳回",
                         OperateType = 1,//增加
-                        BeforeAmount = users.ValidAmount+ users.TotalAmt + users.ValidForGetAmount,
-                        AfterAmount = users.ValidAmount+ users.TotalAmt + users.ValidForGetAmount + query.UseAmount,
+                        BeforeAmount = users.ValidAmount + users.TotalAmt + users.ValidForGetAmount,
+                        AfterAmount = users.ValidAmount + users.TotalAmt + users.ValidForGetAmount + query.UseAmount,
                         UseAmount = query.UseAmount,
                         UserId = query.UserId,
                         ApplyId = query.Id,
@@ -859,23 +859,50 @@ namespace MySystem.Areas.Admin.Controllers
                         //添加机具所属运营中心
                         machine.OpId = tostore.UserId;
 
-                        //额度标记
+                        // //额度标记
+                        // if (ValidAmount >= amount)
+                        // {
+                        //     ValidAmount -= amount;
+                        //     // machine.OpReserveKind = 3;
+                        // }
+                        // else if (TotalAmt >= amount)
+                        // {
+                        //     TotalAmt -= amount;
+                        //     // machine.OpReserveKind = 1;
+                        // }
+                        // else if (ValidForGetAmount >= amount)
+                        // {
+                        //     ValidForGetAmount -= amount;
+                        //     // machine.OpReserveKind = 2;
+                        // }
+
                         if (ValidAmount >= amount)
                         {
                             ValidAmount -= amount;
-                            machine.OpReserveKind = 3;
-                        }
-                        else if (TotalAmt >= amount)
-                        {
-                            TotalAmt -= amount;
-                            machine.OpReserveKind = 1;
+                            machine.OpReserve3 = amount;
+                            machine.OpReserve1 = 0;
+                            machine.OpReserve2 = 0;
                         }
-                        else if (ValidForGetAmount >= amount)
+                        else
                         {
-                            ValidForGetAmount -= amount;
-                            machine.OpReserveKind = 2;
+                            if (TotalAmt >= amount)
+                            {
+                                TotalAmt -= amount - ValidAmount;
+                                machine.OpReserve3 = ValidAmount;
+                                machine.OpReserve1 = amount - ValidAmount;
+                                machine.OpReserve2 = 0;
+                            }
+                            else
+                            {
+                                if (ValidForGetAmount >= amount)
+                                {
+                                    ValidForGetAmount -= amount - TotalAmt;
+                                    machine.OpReserve3 = 0;
+                                    machine.OpReserve1 = TotalAmt;
+                                    machine.OpReserve2 = amount - TotalAmt;
+                                }
+                            }
                         }
-
                         db.SaveChanges();
                     }
                 }

+ 3 - 1
Models/PosMachinesTwo.cs

@@ -53,6 +53,8 @@ namespace MySystem.Models
         public ulong DownFeeFlag { get; set; }
         public ulong UpFeeFlag { get; set; }
         public int OpId { get; set; }
-        public int OpReserveKind { get; set; }
+        public decimal OpReserve3 { get; set; }
+        public decimal OpReserve2 { get; set; }
+        public decimal OpReserve1 { get; set; }
     }
 }

+ 5 - 1
Models/WebCMSEntities.cs

@@ -8611,7 +8611,11 @@ namespace MySystem.Models
 
                 entity.Property(e => e.OpId).HasColumnType("int(11)");
 
-                entity.Property(e => e.OpReserveKind).HasColumnType("int(11)");
+                entity.Property(e => e.OpReserve1).HasColumnType("decimal(18,2)");
+
+                entity.Property(e => e.OpReserve2).HasColumnType("decimal(18,2)");
+
+                entity.Property(e => e.OpReserve3).HasColumnType("decimal(18,2)");
 
                 entity.Property(e => e.OrderId).HasColumnType("int(11)");
 

+ 1 - 1
appsettings.json

@@ -14,7 +14,7 @@
     "ConnectionStrings": "",
     "WebServiceUrl": "",
     "DbSchemeUrl": "",
-    "OpHost": "http://operate.kexiaoshuang.com/",
+    "OpHost": "http://operateadmin.kexiaoshuang.com/",
     "Host": "http://test.bs.kexiaoshuang.com/",
     "OssHost": "http://oss.kexiaoshuang.com",
     "Database": "KxsMainServer",