|
|
@@ -553,41 +553,44 @@ 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
|
|
|
- {
|
|
|
- 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;
|
|
|
+ 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 bValidAmount = amount.ValidAmount;
|
|
|
+ var aValidAmount = amount.ValidAmount - sto.Deposit + data.Deposit;
|
|
|
+
|
|
|
+ OpAmountItem opAmountItem = new OpAmountItem
|
|
|
{
|
|
|
- CreateDate = DateTime.Now,
|
|
|
- UserId = sto.OpId,
|
|
|
- SeoDescription = "分仓押金变更",
|
|
|
- OperateType = 2,
|
|
|
- UseAmount = olddeposit - newdeposit,
|
|
|
- BeforeAmount = amount.ValidAmount,
|
|
|
- AfterAmount = amount.ValidAmount + newdeposit - olddeposit,
|
|
|
- AfterTotalAmt = amount.TotalAmt,
|
|
|
- AfterValidForGetAmount = amount.ValidForGetAmount,
|
|
|
- AfterValidAmount = amount.ValidAmount + newdeposit - olddeposit
|
|
|
- }).Entity;
|
|
|
+ UserId = sto.OpId,//创客Id
|
|
|
+ OperateType = OperateType,//操作类型(0 总和 1 增加 2 减少)
|
|
|
+ ChangeType = 3,//类别
|
|
|
+ Remark = "分仓押金变更",//备注
|
|
|
+ UseAmount = UseAmount,//变更总额度
|
|
|
+ UseValidForGetAmount = 0,//变更可提现额度
|
|
|
+ UseTotalAmt = 0,//变更未使用额度
|
|
|
+ UseValidAmount = Math.Max(0, bValidAmount - aValidAmount),//变更关联分仓额度
|
|
|
+ DataType = 7,//来源类型,区分表(1订单,2机具,3申请记录,4购买运营中心,5预扣款 6兑换大盟主 7仓库)
|
|
|
+ DataId = sto.Id,//来源Id,表的主键Id
|
|
|
+ NoAccount = 1//是否入账(0 是 1 否)
|
|
|
+ };
|
|
|
+
|
|
|
+ RedisDbconn.Instance.AddList("OperateAmountRecordServiceQueue", opAmountItem);
|
|
|
+
|
|
|
+ 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();
|
|
|
@@ -626,41 +629,45 @@ 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
|
|
|
- {
|
|
|
- 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;
|
|
|
+ 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 bValidAmount = amount.ValidAmount;
|
|
|
+ var aValidAmount = amount.ValidAmount - sto.Deposit + data.Deposit;
|
|
|
+
|
|
|
+ OpAmountItem opAmountItem = new OpAmountItem
|
|
|
{
|
|
|
- CreateDate = DateTime.Now,
|
|
|
- UserId = sto.OpId,
|
|
|
- SeoDescription = "分仓押金变更",
|
|
|
- OperateType = 2,
|
|
|
- UseAmount = olddeposit - newdeposit,
|
|
|
- BeforeAmount = amount.ValidAmount,
|
|
|
- AfterAmount = amount.ValidAmount + newdeposit - olddeposit,
|
|
|
- AfterTotalAmt = amount.TotalAmt,
|
|
|
- AfterValidForGetAmount = amount.ValidForGetAmount,
|
|
|
- AfterValidAmount = amount.ValidAmount + newdeposit - olddeposit
|
|
|
- }).Entity;
|
|
|
+ UserId = sto.OpId,//创客Id
|
|
|
+ OperateType = OperateType,//操作类型(0 总和 1 增加 2 减少)
|
|
|
+ ChangeType = 3,//类别
|
|
|
+ Remark = "分仓押金变更",//备注
|
|
|
+ UseAmount = UseAmount,//变更总额度
|
|
|
+ UseValidForGetAmount = 0,//变更可提现额度
|
|
|
+ UseTotalAmt = 0,//变更未使用额度
|
|
|
+ UseValidAmount = Math.Max(0, bValidAmount - aValidAmount),//变更关联分仓额度
|
|
|
+ DataType = 7,//来源类型,区分表(1订单,2机具,3申请记录,4购买运营中心,5预扣款 6兑换大盟主 7仓库)
|
|
|
+ DataId = sto.Id,//来源Id,表的主键Id
|
|
|
+ NoAccount = 1//是否入账(0 是 1 否)
|
|
|
+ };
|
|
|
+
|
|
|
+ RedisDbconn.Instance.AddList("OperateAmountRecordServiceQueue", opAmountItem);
|
|
|
+
|
|
|
+ amount.ValidAmount -= sto.Deposit;
|
|
|
+ amount.ValidAmount += data.Deposit;
|
|
|
}
|
|
|
- amount.ValidAmount -= sto.Deposit;
|
|
|
- amount.ValidAmount += data.Deposit;
|
|
|
}
|
|
|
foreach (var item in store)
|
|
|
{
|
|
|
@@ -2028,6 +2035,9 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
userAmount.ValidAmount += deposit;
|
|
|
opdb.SaveChanges();
|
|
|
decimal toAmount = userAmount.ValidAmount + userAmount.TotalAmt + userAmount.ValidForGetAmount;//新的总金额
|
|
|
+ decimal ValidAmount = 0.00M;//关联分仓额度
|
|
|
+ decimal TotalAmt = 0.00M; //未使用额度
|
|
|
+ decimal ValidForGetAmount = 0.00M; //可提现额度
|
|
|
if (toAmount >= tamount)
|
|
|
{
|
|
|
foreach (var item in idlist)
|
|
|
@@ -2057,6 +2067,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
posInfo.OpId = sysAdmin.UserId;
|
|
|
if (userAmount.ValidAmount - amount >= 0)
|
|
|
{
|
|
|
+ ValidAmount += amount;
|
|
|
userAmount.ValidAmount -= amount;
|
|
|
posInfo.OpReserve3 += amount; //关联分仓额度
|
|
|
posInfo.OpReserve1 = 0; //未使用额度
|
|
|
@@ -2067,6 +2078,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
{
|
|
|
if (userAmount.TotalAmt - amount >= 0)
|
|
|
{
|
|
|
+ TotalAmt += amount - userAmount.ValidAmount;
|
|
|
userAmount.TotalAmt -= amount - userAmount.ValidAmount;
|
|
|
posInfo.OpReserve3 = userAmount.ValidAmount;
|
|
|
posInfo.OpReserve1 = amount - userAmount.ValidAmount;
|
|
|
@@ -2077,6 +2089,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
{
|
|
|
if (userAmount.ValidForGetAmount - amount >= 0)
|
|
|
{
|
|
|
+ ValidForGetAmount += amount - userAmount.TotalAmt;
|
|
|
userAmount.ValidForGetAmount -= amount - userAmount.TotalAmt;
|
|
|
posInfo.OpReserve3 = 0;
|
|
|
posInfo.OpReserve1 = userAmount.TotalAmt;
|
|
|
@@ -2125,38 +2138,25 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
}
|
|
|
if (IsOk == "1")
|
|
|
{
|
|
|
- if (deposit > tamount)
|
|
|
- {
|
|
|
- var amoutRecord = opdb.AmountRecord.Add(new OpModels.AmountRecord
|
|
|
- {
|
|
|
- CreateDate = DateTime.Now,
|
|
|
- UserId = sysAdmin.UserId,
|
|
|
- SeoDescription = "关联分仓",
|
|
|
- OperateType = 1,
|
|
|
- UseAmount = deposit - tamount,
|
|
|
- BeforeAmount = TotalAmount,
|
|
|
- AfterAmount = TotalAmount + deposit - tamount,
|
|
|
- AfterTotalAmt = userAmount.TotalAmt,
|
|
|
- AfterValidForGetAmount = userAmount.ValidForGetAmount,
|
|
|
- AfterValidAmount = userAmount.ValidAmount,
|
|
|
- }).Entity;
|
|
|
- }
|
|
|
- if (deposit < tamount)
|
|
|
+
|
|
|
+ var aTotalAmount = TotalAmount + deposit - tamount;
|
|
|
+
|
|
|
+ OpAmountItem opAmountItem = new OpAmountItem
|
|
|
{
|
|
|
- var amoutRecord = opdb.AmountRecord.Add(new OpModels.AmountRecord
|
|
|
- {
|
|
|
- CreateDate = DateTime.Now,
|
|
|
- UserId = sysAdmin.UserId,
|
|
|
- SeoDescription = "关联分仓",
|
|
|
- OperateType = 2,
|
|
|
- UseAmount = tamount - deposit,
|
|
|
- BeforeAmount = TotalAmount,
|
|
|
- AfterAmount = TotalAmount + deposit - tamount,
|
|
|
- AfterTotalAmt = userAmount.TotalAmt,
|
|
|
- AfterValidForGetAmount = userAmount.ValidForGetAmount,
|
|
|
- AfterValidAmount = userAmount.ValidAmount,
|
|
|
- }).Entity;
|
|
|
- }
|
|
|
+ UserId = sysAdmin.UserId,//创客Id
|
|
|
+ OperateType = 0,//操作类型(0 总和 1 增加 2 减少)
|
|
|
+ ChangeType = 2,//类别
|
|
|
+ Remark = "关联分仓",//备注
|
|
|
+ UseAmount = Math.Max(0, TotalAmount - aTotalAmount),//变更总额度
|
|
|
+ UseValidForGetAmount = ValidForGetAmount,//变更可提现额度
|
|
|
+ UseTotalAmt = TotalAmt,//变更未使用额度
|
|
|
+ UseValidAmount = ValidAmount,//变更关联分仓额度
|
|
|
+ DataType = 0,//来源类型,区分表(1订单,2机具,3申请记录,4购买运营中心,5预扣款 6兑换大盟主 7仓库)
|
|
|
+ DataId = 0,//来源Id,表的主键Id
|
|
|
+ NoAccount = 1//是否入账(0 是 1 否)
|
|
|
+ };
|
|
|
+
|
|
|
+ RedisDbconn.Instance.AddList("OperateAmountRecordServiceQueue", opAmountItem);
|
|
|
opdb.SaveChanges();
|
|
|
}
|
|
|
sysAdmin.StoreCount += idlist.Count();//添加关联分仓数
|
|
|
@@ -2260,9 +2260,9 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
var amount = 0;
|
|
|
var tamount = 0;
|
|
|
decimal deposit = 0;
|
|
|
- decimal ValidAmount = 0;
|
|
|
- decimal TotalAmt = 0;
|
|
|
- decimal ValidForGetAmount = 0;
|
|
|
+ decimal ValidAmount = 0.00M;//关联分仓额度
|
|
|
+ decimal TotalAmt = 0.00M; //未使用额度
|
|
|
+ decimal ValidForGetAmount = 0.00M; //可提现额度
|
|
|
var pCount = 0;
|
|
|
var userIds = "";
|
|
|
string error = "";
|
|
|
@@ -2344,6 +2344,9 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
opdb.SaveChanges();
|
|
|
}
|
|
|
}
|
|
|
+ var bValidAmount = userAmount.ValidAmount;
|
|
|
+ var aValidAmount = userAmount.ValidAmount - deposit + ValidAmount;
|
|
|
+
|
|
|
userAmount.ValidAmount -= deposit;//扣减关联分仓押金
|
|
|
userAmount.ValidAmount += ValidAmount;
|
|
|
userAmount.TotalAmt += TotalAmt;
|
|
|
@@ -2351,38 +2354,23 @@ 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)
|
|
|
+
|
|
|
+ OpAmountItem opAmountItem = new OpAmountItem
|
|
|
{
|
|
|
- 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;
|
|
|
- }
|
|
|
+ UserId = sysAdmin.UserId,//创客Id
|
|
|
+ OperateType = 0,//操作类型(0 总和 1 增加 2 减少)
|
|
|
+ ChangeType = 22,//类别
|
|
|
+ Remark = "取消关联分仓",//备注
|
|
|
+ UseAmount = Math.Max(0, bValidAmount - aValidAmount),//变更总额度
|
|
|
+ UseValidForGetAmount = ValidForGetAmount,//变更可提现额度
|
|
|
+ UseTotalAmt = TotalAmt,//变更未使用额度
|
|
|
+ UseValidAmount = Math.Max(0, bValidAmount - aValidAmount),//变更关联分仓额度
|
|
|
+ DataType = 0,//来源类型,区分表(1订单,2机具,3申请记录,4购买运营中心,5预扣款 6兑换大盟主 7仓库)
|
|
|
+ DataId = 0,//来源Id,表的主键Id
|
|
|
+ NoAccount = 1//是否入账(0 是 1 否)
|
|
|
+ };
|
|
|
+
|
|
|
+ RedisDbconn.Instance.AddList("OperateAmountRecordServiceQueue", opAmountItem);
|
|
|
opdb.SaveChanges();
|
|
|
}
|
|
|
else
|