|
@@ -39,50 +39,50 @@ namespace MySystem
|
|
|
int Kind = int.Parse(function.CheckInt(jsonObj["Kind"].ToString())); //1-机具,2-机具券
|
|
|
decimal Amount = decimal.Parse(function.CheckNum(jsonObj["Amount"].ToString()));
|
|
|
|
|
|
- UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == UserId);
|
|
|
- if (account == null)
|
|
|
- {
|
|
|
- account = db.UserAccount.Add(new UserAccount()
|
|
|
- {
|
|
|
- Id = UserId,
|
|
|
- UserId = UserId,
|
|
|
- }).Entity;
|
|
|
- db.SaveChanges();
|
|
|
- }
|
|
|
- decimal BeforeAmount = account.ValidAmount; //变更前总金额
|
|
|
- account.ValidAmount += Amount;
|
|
|
- decimal AfterAmount = account.ValidAmount; //变更后总金额
|
|
|
- AmountRecord add = db.AmountRecord.Add(new AmountRecord()
|
|
|
- {
|
|
|
- CreateDate = DateTime.Now,
|
|
|
- UpdateDate = DateTime.Now,
|
|
|
- OperateType = 1,
|
|
|
- AfterAmount = AfterAmount,
|
|
|
- AfterValidForGetAmount = account.ValidForGetAmount,
|
|
|
- AfterTotalAmt = account.TotalAmt,
|
|
|
- AfterValidAmount = account.ValidAmount,
|
|
|
- BeforeAmount = BeforeAmount,
|
|
|
- UseAmount = Amount,
|
|
|
- UserId = UserId,
|
|
|
- ApplyId = DataId,
|
|
|
- SeoDescription = Kind == 1 ? "机具激活返还" : "机具券兑换返还",
|
|
|
- Version = 3,
|
|
|
- }).Entity;
|
|
|
- db.SaveChanges();
|
|
|
+ // UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == UserId);
|
|
|
+ // if (account == null)
|
|
|
+ // {
|
|
|
+ // account = db.UserAccount.Add(new UserAccount()
|
|
|
+ // {
|
|
|
+ // Id = UserId,
|
|
|
+ // UserId = UserId,
|
|
|
+ // }).Entity;
|
|
|
+ // db.SaveChanges();
|
|
|
+ // }
|
|
|
+ // decimal BeforeAmount = account.ValidAmount; //变更前总金额
|
|
|
+ // account.ValidAmount += Amount;
|
|
|
+ // decimal AfterAmount = account.ValidAmount; //变更后总金额
|
|
|
+ // AmountRecord add = db.AmountRecord.Add(new AmountRecord()
|
|
|
+ // {
|
|
|
+ // CreateDate = DateTime.Now,
|
|
|
+ // UpdateDate = DateTime.Now,
|
|
|
+ // OperateType = 1,
|
|
|
+ // AfterAmount = AfterAmount,
|
|
|
+ // AfterValidForGetAmount = account.ValidForGetAmount,
|
|
|
+ // AfterTotalAmt = account.TotalAmt,
|
|
|
+ // AfterValidAmount = account.ValidAmount,
|
|
|
+ // BeforeAmount = BeforeAmount,
|
|
|
+ // UseAmount = Amount,
|
|
|
+ // UserId = UserId,
|
|
|
+ // ApplyId = DataId,
|
|
|
+ // SeoDescription = Kind == 1 ? "机具激活返还" : "机具券兑换返还",
|
|
|
+ // Version = 3,
|
|
|
+ // }).Entity;
|
|
|
+ // db.SaveChanges();
|
|
|
|
|
|
- AmountChangeRecord amountChangeRecord = db.AmountChangeRecord.Add(new AmountChangeRecord()
|
|
|
- {
|
|
|
- AmountType = 2,//1 未使用额度 2 可提现额度 3 关联分仓额度
|
|
|
- CreateDate = DateTime.Now,
|
|
|
- Title = Kind == 1 ? "机具激活返还" : "机具券兑换返还",
|
|
|
- UserId = UserId, //运营中心Id
|
|
|
- BeforeAmount = BeforeAmount,//使用前剩余额度
|
|
|
- AfterAmount = AfterAmount,//使用后剩余额度
|
|
|
- ChangeAmount = Amount,//操作金额
|
|
|
- OperateType = 1,//操作类别
|
|
|
- }).Entity;
|
|
|
+ // AmountChangeRecord amountChangeRecord = db.AmountChangeRecord.Add(new AmountChangeRecord()
|
|
|
+ // {
|
|
|
+ // AmountType = 2,//1 未使用额度 2 可提现额度 3 关联分仓额度
|
|
|
+ // CreateDate = DateTime.Now,
|
|
|
+ // Title = Kind == 1 ? "机具激活返还" : "机具券兑换返还",
|
|
|
+ // UserId = UserId, //运营中心Id
|
|
|
+ // BeforeAmount = BeforeAmount,//使用前剩余额度
|
|
|
+ // AfterAmount = AfterAmount,//使用后剩余额度
|
|
|
+ // ChangeAmount = Amount,//操作金额
|
|
|
+ // OperateType = 1,//操作类别
|
|
|
+ // }).Entity;
|
|
|
|
|
|
- db.Dispose();
|
|
|
+ // db.Dispose();
|
|
|
|
|
|
OpAmountItem item = new OpAmountItem()
|
|
|
{
|