浏览代码

调整运营中心返额度逻辑

lichunlei 2 年之前
父节点
当前提交
21860807c5
共有 2 个文件被更改,包括 22 次插入6 次删除
  1. 20 5
      AppStart/Helper/AlipayPayBack2Service.cs
  2. 2 1
      Controllers/HomeController.cs

+ 20 - 5
AppStart/Helper/AlipayPayBack2Service.cs

@@ -426,7 +426,6 @@ namespace MySystem
                                                             }
                                                             }
                                                         }
                                                         }
                                                         db.SaveChanges();
                                                         db.SaveChanges();
-                                                        OperateReserveBack(puser.Id, order.TotalPrice);
                                                         OperateFlag = false;
                                                         OperateFlag = false;
                                                     }
                                                     }
                                                 }
                                                 }
@@ -437,6 +436,8 @@ namespace MySystem
                                                 PUserId = 0;
                                                 PUserId = 0;
                                             }
                                             }
                                         }
                                         }
+                                        //运营中心返额度(下单人自己是运营中心)
+                                        OperateReserveBackFor(db, order.UserId, order.TotalPrice);
                                     }
                                     }
                                     return;
                                     return;
                                 }
                                 }
@@ -548,6 +549,8 @@ namespace MySystem
                                     }
                                     }
                                     ParentUserId = puser.ParentUserId;
                                     ParentUserId = puser.ParentUserId;
                                 }
                                 }
+                                //运营中心返额度
+                                OperateReserveBackFor(db, order.UserId, order.TotalPrice);
                             }
                             }
                         }
                         }
                         function.WriteLog("\r\n\r\n", "推荐下单奖励监控日志");
                         function.WriteLog("\r\n\r\n", "推荐下单奖励监控日志");
@@ -904,38 +907,50 @@ namespace MySystem
                 }).Entity;
                 }).Entity;
                 db.SaveChanges();
                 db.SaveChanges();
             }
             }
-            decimal BeforeAmount = account.ValidAmount; //变更前总金额
+            decimal BeforeAmount = 0; //变更前总金额
+            decimal AfterAmount = 0; //变更后总金额
             if(OperateType == 1)
             if(OperateType == 1)
             {
             {
                 if(AmountType == 1)
                 if(AmountType == 1)
                 {
                 {
+                    BeforeAmount = account.TotalAmt;
                     account.TotalAmt += Money;
                     account.TotalAmt += Money;
+                    AfterAmount = account.TotalAmt;
                 }
                 }
-                else if(AmountType == 1)
+                else if(AmountType == 2)
                 {
                 {
+                    BeforeAmount = account.ValidForGetAmount;
                     account.ValidForGetAmount += Money;
                     account.ValidForGetAmount += Money;
+                    AfterAmount = account.ValidForGetAmount;
                 }
                 }
                 else
                 else
                 {
                 {
+                    BeforeAmount = account.ValidAmount;
                     account.ValidAmount += Money;
                     account.ValidAmount += Money;
+                    AfterAmount = account.ValidAmount;
                 }
                 }
             }
             }
             else
             else
             {
             {
                 if(AmountType == 1)
                 if(AmountType == 1)
                 {
                 {
+                    BeforeAmount = account.TotalAmt;
                     account.TotalAmt -= Money;
                     account.TotalAmt -= Money;
+                    AfterAmount = account.TotalAmt;
                 }
                 }
-                else if(AmountType == 1)
+                else if(AmountType == 2)
                 {
                 {
+                    BeforeAmount = account.ValidForGetAmount;
                     account.ValidForGetAmount -= Money;
                     account.ValidForGetAmount -= Money;
+                    AfterAmount = account.ValidForGetAmount;
                 }
                 }
                 else
                 else
                 {
                 {
+                    BeforeAmount = account.ValidAmount;
                     account.ValidAmount -= Money;
                     account.ValidAmount -= Money;
+                    AfterAmount = account.ValidAmount;
                 }
                 }
             }
             }
-            decimal AfterAmount = account.ValidAmount; //变更后总金额
             OpModels.AmountRecord add = db.AmountRecord.Add(new OpModels.AmountRecord()
             OpModels.AmountRecord add = db.AmountRecord.Add(new OpModels.AmountRecord()
             {
             {
                 CreateDate = DateTime.Now,
                 CreateDate = DateTime.Now,

+ 2 - 1
Controllers/HomeController.cs

@@ -1266,7 +1266,8 @@ namespace MySystem.Controllers
         public string test3()
         public string test3()
         {
         {
             WebCMSEntities db = new WebCMSEntities();
             WebCMSEntities db = new WebCMSEntities();
-            StoreApplyHelper.Instance.DoSomething(db, 89);
+            // StoreApplyHelper.Instance.DoSomething(db, 89);
+            AlipayPayBack2Service.Instance.DoOrderV2(db, 94525);
             return "ok";
             return "ok";
         }
         }
     }
     }