|
|
@@ -553,52 +553,34 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
userAccountOld.TempAmountForBalance = 0;
|
|
|
if (sto.OpId > 0)
|
|
|
{
|
|
|
- var amount = opdb.UserAccount.FirstOrDefault(m => m.UserId == sto.OpId) ?? new OpModels.UserAccount();
|
|
|
- if (newdeposit > olddeposit)
|
|
|
+ var UseAmount = 0.00M;
|
|
|
+ var OperateType = 0;
|
|
|
+ if (newdeposit >= olddeposit)
|
|
|
{
|
|
|
- var amoutRecord = opdb.AmountRecord.Add(new OpModels.AmountRecord()
|
|
|
- {
|
|
|
- Version = 3,//1 未使用额度 2 可提现额度 3 关联分仓额度
|
|
|
- CreateDate = DateTime.Now,
|
|
|
- UserId = sto.OpId,
|
|
|
- SeoDescription = "分仓押金变更",
|
|
|
- OperateType = 1,
|
|
|
- UseAmount = newdeposit - olddeposit,
|
|
|
- BeforeAmount = amount.ValidAmount,
|
|
|
- AfterAmount = amount.ValidAmount + newdeposit - olddeposit,
|
|
|
- AfterTotalAmt = amount.TotalAmt,
|
|
|
- AfterValidForGetAmount = amount.ValidForGetAmount,
|
|
|
- AfterValidAmount = amount.ValidAmount + newdeposit - olddeposit,
|
|
|
- }).Entity;
|
|
|
-
|
|
|
- var amountChangeRecord = opdb.AmountChangeRecord.Add(new OpModels.AmountChangeRecord()
|
|
|
- {
|
|
|
- AmountType = 3,//1 未使用额度 2 可提现额度 3 关联分仓额度
|
|
|
- CreateDate = DateTime.Now,
|
|
|
- Title = "分仓押金变更",
|
|
|
- UserId = sto.OpId, //运营中心Id
|
|
|
- // CreateMan = SysUserName + "-" + SysRealName,
|
|
|
- BeforeAmount = amount.ValidAmount,//使用前剩余额度
|
|
|
- AfterAmount = amount.ValidAmount + newdeposit - olddeposit,//使用后剩余额度
|
|
|
- ChangeAmount = newdeposit - olddeposit,//操作金额
|
|
|
- OperateType = 1,//操作类别
|
|
|
- }).Entity;
|
|
|
+ UseAmount = newdeposit - olddeposit;
|
|
|
+ OperateType = 1;
|
|
|
}
|
|
|
if (newdeposit < olddeposit)
|
|
|
{
|
|
|
- var amoutRecord = opdb.AmountRecord.Add(new OpModels.AmountRecord
|
|
|
+ UseAmount = olddeposit - newdeposit;
|
|
|
+ OperateType = 2;
|
|
|
+ }
|
|
|
+ if (UseAmount > 0)
|
|
|
+ {
|
|
|
+ var amount = opdb.UserAccount.FirstOrDefault(m => m.UserId == sto.OpId) ?? new OpModels.UserAccount();
|
|
|
+ var amoutRecord = opdb.AmountRecord.Add(new OpModels.AmountRecord()
|
|
|
{
|
|
|
Version = 3,//1 未使用额度 2 可提现额度 3 关联分仓额度
|
|
|
CreateDate = DateTime.Now,
|
|
|
UserId = sto.OpId,
|
|
|
SeoDescription = "分仓押金变更",
|
|
|
- OperateType = 2,
|
|
|
- UseAmount = olddeposit - newdeposit,
|
|
|
+ OperateType = OperateType,
|
|
|
+ UseAmount = UseAmount,
|
|
|
BeforeAmount = amount.ValidAmount,
|
|
|
- AfterAmount = amount.ValidAmount + newdeposit - olddeposit,
|
|
|
+ AfterAmount = amount.ValidAmount + UseAmount,
|
|
|
AfterTotalAmt = amount.TotalAmt,
|
|
|
AfterValidForGetAmount = amount.ValidForGetAmount,
|
|
|
- AfterValidAmount = amount.ValidAmount + newdeposit - olddeposit
|
|
|
+ AfterValidAmount = amount.ValidAmount + UseAmount,
|
|
|
}).Entity;
|
|
|
|
|
|
var amountChangeRecord = opdb.AmountChangeRecord.Add(new OpModels.AmountChangeRecord()
|
|
|
@@ -607,15 +589,16 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
CreateDate = DateTime.Now,
|
|
|
Title = "分仓押金变更",
|
|
|
UserId = sto.OpId, //运营中心Id
|
|
|
- // CreateMan = SysUserName + "-" + SysRealName,
|
|
|
+ // Operater = SysUserName + "-" + SysRealName,
|
|
|
BeforeAmount = amount.ValidAmount,//使用前剩余额度
|
|
|
- AfterAmount = amount.ValidAmount + newdeposit - olddeposit,//使用后剩余额度
|
|
|
- ChangeAmount = olddeposit - newdeposit,//操作金额
|
|
|
- OperateType = 2,//操作类别
|
|
|
+ AfterAmount = amount.ValidAmount + UseAmount,//使用后剩余额度
|
|
|
+ ChangeAmount = UseAmount,//操作金额
|
|
|
+ OperateType = OperateType,//操作类别
|
|
|
}).Entity;
|
|
|
+
|
|
|
+ amount.ValidAmount -= sto.Deposit;
|
|
|
+ amount.ValidAmount += data.Deposit;
|
|
|
}
|
|
|
- amount.ValidAmount -= sto.Deposit;
|
|
|
- amount.ValidAmount += data.Deposit;
|
|
|
}
|
|
|
var oldUserInfo = db.Users.FirstOrDefault(m => m.Id == sto.UserId) ?? new Users();
|
|
|
var newUserInfo = db.Users.FirstOrDefault(m => m.Id == user.UserId) ?? new Users();
|
|
|
@@ -654,52 +637,34 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
userAccount.StoreDeposit = data.Deposit;
|
|
|
if (sto.OpId > 0)
|
|
|
{
|
|
|
- var amount = opdb.UserAccount.FirstOrDefault(m => m.UserId == sto.OpId) ?? new OpModels.UserAccount();
|
|
|
- if (newdeposit > olddeposit)
|
|
|
+ var UseAmount = 0.00M;
|
|
|
+ var OperateType = 0;
|
|
|
+ if (newdeposit >= olddeposit)
|
|
|
{
|
|
|
- var amoutRecord = opdb.AmountRecord.Add(new OpModels.AmountRecord
|
|
|
- {
|
|
|
- Version = 3,//1 未使用额度 2 可提现额度 3 关联分仓额度
|
|
|
- CreateDate = DateTime.Now,
|
|
|
- UserId = sto.OpId,
|
|
|
- SeoDescription = "分仓押金变更",
|
|
|
- OperateType = 1,
|
|
|
- UseAmount = newdeposit - olddeposit,
|
|
|
- BeforeAmount = amount.ValidAmount,
|
|
|
- AfterAmount = amount.ValidAmount + newdeposit - olddeposit,
|
|
|
- AfterTotalAmt = amount.TotalAmt,
|
|
|
- AfterValidForGetAmount = amount.ValidForGetAmount,
|
|
|
- AfterValidAmount = amount.ValidAmount + newdeposit - olddeposit
|
|
|
- }).Entity;
|
|
|
-
|
|
|
- var amountChangeRecord = opdb.AmountChangeRecord.Add(new OpModels.AmountChangeRecord()
|
|
|
- {
|
|
|
- AmountType = 3,//1 未使用额度 2 可提现额度 3 关联分仓额度
|
|
|
- CreateDate = DateTime.Now,
|
|
|
- Title = "分仓押金变更",
|
|
|
- UserId = sto.OpId, //运营中心Id
|
|
|
- // CreateMan = SysUserName + "-" + SysRealName,
|
|
|
- BeforeAmount = amount.ValidAmount,//使用前剩余额度
|
|
|
- AfterAmount = amount.ValidAmount + newdeposit - olddeposit,//使用后剩余额度
|
|
|
- ChangeAmount = newdeposit - olddeposit,//操作金额
|
|
|
- OperateType = 1,//操作类别
|
|
|
- }).Entity;
|
|
|
+ UseAmount = newdeposit - olddeposit;
|
|
|
+ OperateType = 1;
|
|
|
}
|
|
|
if (newdeposit < olddeposit)
|
|
|
{
|
|
|
- var amoutRecord = opdb.AmountRecord.Add(new OpModels.AmountRecord
|
|
|
+ UseAmount = olddeposit - newdeposit;
|
|
|
+ OperateType = 2;
|
|
|
+ }
|
|
|
+ if (UseAmount > 0)
|
|
|
+ {
|
|
|
+ var amount = opdb.UserAccount.FirstOrDefault(m => m.UserId == sto.OpId) ?? new OpModels.UserAccount();
|
|
|
+ var amoutRecord = opdb.AmountRecord.Add(new OpModels.AmountRecord()
|
|
|
{
|
|
|
Version = 3,//1 未使用额度 2 可提现额度 3 关联分仓额度
|
|
|
CreateDate = DateTime.Now,
|
|
|
UserId = sto.OpId,
|
|
|
SeoDescription = "分仓押金变更",
|
|
|
- OperateType = 2,
|
|
|
- UseAmount = olddeposit - newdeposit,
|
|
|
+ OperateType = OperateType,
|
|
|
+ UseAmount = UseAmount,
|
|
|
BeforeAmount = amount.ValidAmount,
|
|
|
- AfterAmount = amount.ValidAmount + newdeposit - olddeposit,
|
|
|
+ AfterAmount = amount.ValidAmount + UseAmount,
|
|
|
AfterTotalAmt = amount.TotalAmt,
|
|
|
AfterValidForGetAmount = amount.ValidForGetAmount,
|
|
|
- AfterValidAmount = amount.ValidAmount + newdeposit - olddeposit
|
|
|
+ AfterValidAmount = amount.ValidAmount + UseAmount,
|
|
|
}).Entity;
|
|
|
|
|
|
var amountChangeRecord = opdb.AmountChangeRecord.Add(new OpModels.AmountChangeRecord()
|
|
|
@@ -708,15 +673,16 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
CreateDate = DateTime.Now,
|
|
|
Title = "分仓押金变更",
|
|
|
UserId = sto.OpId, //运营中心Id
|
|
|
- // CreateMan = SysUserName + "-" + SysRealName,
|
|
|
+ // Operater = SysUserName + "-" + SysRealName,
|
|
|
BeforeAmount = amount.ValidAmount,//使用前剩余额度
|
|
|
- AfterAmount = amount.ValidAmount + newdeposit - olddeposit,//使用后剩余额度
|
|
|
- ChangeAmount = olddeposit - newdeposit,//操作金额
|
|
|
- OperateType = 2,//操作类别
|
|
|
+ AfterAmount = amount.ValidAmount + UseAmount,//使用后剩余额度
|
|
|
+ ChangeAmount = UseAmount,//操作金额
|
|
|
+ OperateType = OperateType,//操作类别
|
|
|
}).Entity;
|
|
|
+
|
|
|
+ amount.ValidAmount -= sto.Deposit;
|
|
|
+ amount.ValidAmount += data.Deposit;
|
|
|
}
|
|
|
- amount.ValidAmount -= sto.Deposit;
|
|
|
- amount.ValidAmount += data.Deposit;
|
|
|
}
|
|
|
foreach (var item in store)
|
|
|
{
|
|
|
@@ -2187,7 +2153,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
{
|
|
|
var OperateType = 0;
|
|
|
var Amount = 0.00M;
|
|
|
- if (deposit > tamount)
|
|
|
+ if (deposit >= tamount)
|
|
|
{
|
|
|
OperateType = 1;
|
|
|
Amount = deposit - tamount;
|
|
|
@@ -2197,19 +2163,23 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
OperateType = 2;
|
|
|
Amount = tamount - deposit;
|
|
|
}
|
|
|
- var amoutRecord = opdb.AmountRecord.Add(new OpModels.AmountRecord
|
|
|
+ if (Amount > 0)
|
|
|
{
|
|
|
- CreateDate = DateTime.Now,
|
|
|
- UserId = sysAdmin.UserId,
|
|
|
- SeoDescription = "关联分仓",
|
|
|
- OperateType = OperateType,
|
|
|
- UseAmount = Amount,
|
|
|
- BeforeAmount = TotalAmount,
|
|
|
- AfterAmount = TotalAmount + deposit - tamount,
|
|
|
- AfterTotalAmt = userAmount.TotalAmt,
|
|
|
- AfterValidForGetAmount = userAmount.ValidForGetAmount,
|
|
|
- AfterValidAmount = userAmount.ValidAmount,
|
|
|
- }).Entity;
|
|
|
+ var amoutRecord = opdb.AmountRecord.Add(new OpModels.AmountRecord
|
|
|
+ {
|
|
|
+ CreateDate = DateTime.Now,
|
|
|
+ UserId = sysAdmin.UserId,
|
|
|
+ SeoDescription = "关联分仓",
|
|
|
+ OperateType = OperateType,
|
|
|
+ UseAmount = Amount,
|
|
|
+ BeforeAmount = TotalAmount,
|
|
|
+ AfterAmount = TotalAmount + deposit - tamount,
|
|
|
+ AfterTotalAmt = userAmount.TotalAmt,
|
|
|
+ AfterValidForGetAmount = userAmount.ValidForGetAmount,
|
|
|
+ AfterValidAmount = userAmount.ValidAmount,
|
|
|
+ }).Entity;
|
|
|
+ }
|
|
|
+
|
|
|
for (int i = 1; i <= 3; i++)
|
|
|
{
|
|
|
var UseAmount = 0.00M;
|
|
|
@@ -2218,19 +2188,19 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
if (i == 1)
|
|
|
{
|
|
|
UseAmount = TotalAmt;
|
|
|
- BeforeAmount = userAmount.TotalAmt - UseAmount;
|
|
|
+ BeforeAmount = userAmount.TotalAmt + UseAmount;
|
|
|
AfterAmount = userAmount.TotalAmt;
|
|
|
}
|
|
|
if (i == 2)
|
|
|
{
|
|
|
UseAmount = ValidForGetAmount;
|
|
|
- BeforeAmount = userAmount.ValidForGetAmount - UseAmount;
|
|
|
+ BeforeAmount = userAmount.ValidForGetAmount + UseAmount;
|
|
|
AfterAmount = userAmount.ValidForGetAmount;
|
|
|
}
|
|
|
if (i == 3)
|
|
|
{
|
|
|
UseAmount = ValidAmount;
|
|
|
- BeforeAmount = userAmount.ValidAmount - UseAmount;
|
|
|
+ BeforeAmount = userAmount.ValidAmount + UseAmount;
|
|
|
AfterAmount = userAmount.ValidAmount;
|
|
|
}
|
|
|
if (i > 0 && UseAmount > 0)
|
|
|
@@ -2241,7 +2211,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
CreateDate = DateTime.Now,
|
|
|
Title = "关联分仓",
|
|
|
UserId = sysAdmin.UserId, //运营中心Id
|
|
|
- // CreateMan = SysUserName + "-" + SysRealName,
|
|
|
+ Operater = SysUserName + "-" + SysRealName,
|
|
|
BeforeAmount = BeforeAmount,//使用前剩余额度
|
|
|
AfterAmount = AfterAmount,//使用后剩余额度
|
|
|
ChangeAmount = UseAmount,//操作金额
|
|
|
@@ -2443,38 +2413,35 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
|
|
|
sysAdmin.StoreCount -= idlist.Count();//减少关联分仓数
|
|
|
sysAdmin.TotalMachineCount -= pCount;//减少关联分仓机具数
|
|
|
- // if (deposit > tamount)
|
|
|
- // {
|
|
|
- // var amoutRecord = opdb.AmountRecord.Add(new OpModels.AmountRecord
|
|
|
- // {
|
|
|
- // CreateDate = DateTime.Now,
|
|
|
- // UserId = sysAdmin.UserId,
|
|
|
- // SeoDescription = "取消关联分仓",
|
|
|
- // OperateType = 2,
|
|
|
- // UseAmount = deposit - tamount,
|
|
|
- // BeforeAmount = TotalAmount,
|
|
|
- // AfterAmount = TotalAmount - deposit + tamount,
|
|
|
- // AfterTotalAmt = userAmount.TotalAmt,
|
|
|
- // AfterValidForGetAmount = userAmount.ValidForGetAmount,
|
|
|
- // AfterValidAmount = userAmount.ValidAmount,
|
|
|
- // }).Entity;
|
|
|
- // }
|
|
|
- // if (deposit < tamount)
|
|
|
- // {
|
|
|
- // var amoutRecord = opdb.AmountRecord.Add(new OpModels.AmountRecord
|
|
|
- // {
|
|
|
- // CreateDate = DateTime.Now,
|
|
|
- // UserId = sysAdmin.UserId,
|
|
|
- // SeoDescription = "取消关联分仓",
|
|
|
- // OperateType = 1,
|
|
|
- // UseAmount = tamount - deposit,
|
|
|
- // BeforeAmount = TotalAmount,
|
|
|
- // AfterAmount = TotalAmount - deposit + tamount,
|
|
|
- // AfterTotalAmt = userAmount.TotalAmt,
|
|
|
- // AfterValidForGetAmount = userAmount.ValidForGetAmount,
|
|
|
- // AfterValidAmount = userAmount.ValidAmount,
|
|
|
- // }).Entity;
|
|
|
- // }
|
|
|
+
|
|
|
+ var OperateType = 0;
|
|
|
+ var Amount = 0.00M;
|
|
|
+ if (deposit >= tamount)
|
|
|
+ {
|
|
|
+ OperateType = 1;
|
|
|
+ Amount = deposit - tamount;
|
|
|
+ }
|
|
|
+ if (deposit < tamount)
|
|
|
+ {
|
|
|
+ OperateType = 2;
|
|
|
+ Amount = tamount - deposit;
|
|
|
+ }
|
|
|
+ if (Amount > 0)
|
|
|
+ {
|
|
|
+ var amoutRecord = opdb.AmountRecord.Add(new OpModels.AmountRecord
|
|
|
+ {
|
|
|
+ CreateDate = DateTime.Now,
|
|
|
+ UserId = sysAdmin.UserId,
|
|
|
+ SeoDescription = "取消关联分仓",
|
|
|
+ OperateType = OperateType,
|
|
|
+ UseAmount = Amount,
|
|
|
+ BeforeAmount = TotalAmount,
|
|
|
+ AfterAmount = TotalAmount - deposit + tamount,
|
|
|
+ AfterTotalAmt = userAmount.TotalAmt,
|
|
|
+ AfterValidForGetAmount = userAmount.ValidForGetAmount,
|
|
|
+ AfterValidAmount = userAmount.ValidAmount,
|
|
|
+ }).Entity;
|
|
|
+ }
|
|
|
|
|
|
for (int i = 1; i <= 3; i++)
|
|
|
{
|
|
|
@@ -2499,64 +2466,19 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
BeforeAmount = userAmount.ValidAmount - UseAmount;
|
|
|
AfterAmount = userAmount.ValidAmount;
|
|
|
}
|
|
|
- if (deposit > tamount && UseAmount > 0)
|
|
|
+ if (i > 0 && UseAmount > 0)
|
|
|
{
|
|
|
- var amoutRecord = opdb.AmountRecord.Add(new OpModels.AmountRecord
|
|
|
- {
|
|
|
- Version = i,//1 未使用额度 2 可提现额度 3 关联分仓额度
|
|
|
- CreateDate = DateTime.Now,
|
|
|
- UserId = sysAdmin.UserId,
|
|
|
- SeoDescription = "取消关联分仓",
|
|
|
- OperateType = 2,
|
|
|
- UseAmount = UseAmount,
|
|
|
- BeforeAmount = TotalAmount,
|
|
|
- AfterAmount = TotalAmount - deposit + tamount,
|
|
|
- AfterTotalAmt = userAmount.TotalAmt,
|
|
|
- AfterValidForGetAmount = userAmount.ValidForGetAmount,
|
|
|
- AfterValidAmount = userAmount.ValidAmount,
|
|
|
- }).Entity;
|
|
|
-
|
|
|
- var amountChangeRecord = opdb.AmountChangeRecord.Add(new OpModels.AmountChangeRecord()
|
|
|
- {
|
|
|
- AmountType = i,//1 未使用额度 2 可提现额度 3 关联分仓额度
|
|
|
- CreateDate = DateTime.Now,
|
|
|
- Title = "取消关联分仓",
|
|
|
- UserId = sysAdmin.UserId, //运营中心Id
|
|
|
- // CreateMan = SysUserName + "-" + SysRealName,
|
|
|
- BeforeAmount = BeforeAmount,//使用前剩余额度
|
|
|
- AfterAmount = AfterAmount,//使用后剩余额度
|
|
|
- ChangeAmount = UseAmount,//操作金额
|
|
|
- OperateType = 1,//操作类别
|
|
|
- }).Entity;
|
|
|
- }
|
|
|
- if (deposit < tamount && UseAmount > 0)
|
|
|
- {
|
|
|
- var amoutRecord = opdb.AmountRecord.Add(new OpModels.AmountRecord
|
|
|
- {
|
|
|
- Version = i,//1 未使用额度 2 可提现额度 3 关联分仓额度
|
|
|
- CreateDate = DateTime.Now,
|
|
|
- UserId = sysAdmin.UserId,
|
|
|
- SeoDescription = "取消关联分仓",
|
|
|
- OperateType = 1,
|
|
|
- UseAmount = UseAmount,
|
|
|
- BeforeAmount = TotalAmount,
|
|
|
- AfterAmount = TotalAmount - deposit + tamount,
|
|
|
- AfterTotalAmt = userAmount.TotalAmt,
|
|
|
- AfterValidForGetAmount = userAmount.ValidForGetAmount,
|
|
|
- AfterValidAmount = userAmount.ValidAmount,
|
|
|
- }).Entity;
|
|
|
-
|
|
|
var amountChangeRecord = opdb.AmountChangeRecord.Add(new OpModels.AmountChangeRecord()
|
|
|
{
|
|
|
AmountType = i,//1 未使用额度 2 可提现额度 3 关联分仓额度
|
|
|
CreateDate = DateTime.Now,
|
|
|
Title = "取消关联分仓",
|
|
|
UserId = sysAdmin.UserId, //运营中心Id
|
|
|
- // CreateMan = SysUserName + "-" + SysRealName,
|
|
|
+ Operater = SysUserName + "-" + SysRealName,
|
|
|
BeforeAmount = BeforeAmount,//使用前剩余额度
|
|
|
AfterAmount = AfterAmount,//使用后剩余额度
|
|
|
ChangeAmount = UseAmount,//操作金额
|
|
|
- OperateType = 2,//操作类别
|
|
|
+ OperateType = OperateType,//操作类别
|
|
|
}).Entity;
|
|
|
}
|
|
|
}
|