فهرست منبع

修复创客活动奖励,奖励同步bug

lichunlei 4 سال پیش
والد
کامیت
9edaa9a132
1فایلهای تغییر یافته به همراه31 افزوده شده و 30 حذف شده
  1. 31 30
      Areas/Admin/Controllers/MainServer/SysRechargeRecordController.cs

+ 31 - 30
Areas/Admin/Controllers/MainServer/SysRechargeRecordController.cs

@@ -51,7 +51,7 @@ namespace MySystem.Areas.Admin.Controllers
         /// 创客奖励记录列表
         /// </summary>
         /// <returns></returns>
-        public JsonResult IndexData(SysRechargeRecord data, string MakerCode, string RealName, string StatusSelect, string SyncStatusSelect, int BizType, int page = 1, int limit = 30)
+        public JsonResult IndexData(SysRechargeRecord data, string MakerCode, string RealName, string StatusSelect, string SyncStatusSelect, int page = 1, int limit = 30)
         {
 
             Dictionary<string, string> Fields = new Dictionary<string, string>();
@@ -71,11 +71,6 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 condition += " and UserId in (select UserId from UserForRealName where RealName='" + RealName + "')";
             }
-            //业务类型
-            if (!string.IsNullOrEmpty(BizType.ToString()))
-            {
-                condition += " and BizType=" + BizType;
-            }
             //状态
             if (!string.IsNullOrEmpty(StatusSelect))
             {
@@ -441,33 +436,39 @@ namespace MySystem.Areas.Admin.Controllers
                     edit.Status = 1;
                     edit.SyncStatus = 1;
                     UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == edit.UserId);
-                    if (account != null)
+                    if (account == null)
                     {
-                        decimal BeforeTotalAmount = account.TotalAmount; //变更前总金额
-                        decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
-                        decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
-                        account.TotalAmount += edit.Amount;
-                        account.BalanceAmount += edit.Amount;
-                        decimal AfterTotalAmount = account.TotalAmount; //变更后总金额
-                        decimal AfterFreezeAmount = account.FreezeAmount; //变更后冻结金额
-                        decimal AfterBalanceAmount = account.BalanceAmount; //变更后余额
-                        db.UserAccountRecord.Add(new UserAccountRecord()
+                        account = db.UserAccount.Add(new UserAccount()
                         {
-                            CreateDate = DateTime.Now,
-                            UpdateDate = DateTime.Now,
-                            UserId = edit.UserId, //创客
-                            ChangeType = edit.BizType, //变动类型
-                            ProductType = edit.ProductType, //产品类型
-                            ChangeAmount = edit.Amount, //变更金额
-                            BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
-                            AfterTotalAmount = AfterTotalAmount, //变更后总金额
-                            BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
-                            AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
-                            BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
-                            AfterBalanceAmount = AfterBalanceAmount, //变更后余额
-                            Remark = edit.SeoDescription, //备注
-                        });
+                            Id = edit.UserId,
+                            UserId = edit.UserId,
+                        }).Entity;
+                        db.SaveChanges();
                     }
+                    decimal BeforeTotalAmount = account.TotalAmount; //变更前总金额
+                    decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
+                    decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
+                    account.TotalAmount += edit.Amount;
+                    account.BalanceAmount += edit.Amount;
+                    decimal AfterTotalAmount = account.TotalAmount; //变更后总金额
+                    decimal AfterFreezeAmount = account.FreezeAmount; //变更后冻结金额
+                    decimal AfterBalanceAmount = account.BalanceAmount; //变更后余额
+                    db.UserAccountRecord.Add(new UserAccountRecord()
+                    {
+                        CreateDate = DateTime.Now,
+                        UpdateDate = DateTime.Now,
+                        UserId = edit.UserId, //创客
+                        ChangeType = edit.BizType, //变动类型
+                        ProductType = edit.ProductType, //产品类型
+                        ChangeAmount = edit.Amount, //变更金额
+                        BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
+                        AfterTotalAmount = AfterTotalAmount, //变更后总金额
+                        BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
+                        AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
+                        BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
+                        AfterBalanceAmount = AfterBalanceAmount, //变更后余额
+                        Remark = edit.SeoDescription, //备注
+                    });
                 }
             }
             db.SaveChanges();