public static void SetMemberTradeForRechangeFail(this DbContext db, MemberTradeForRechange model, string errorDesc) { if (model.Status == MemberTradeForRechangeStatus.未完成) { model.Detail += ",支付失败:" + errorDesc; model.Status = MemberTradeForRechangeStatus.失败; } }
public static void SetMemberTradeForRechangeSuccess(this DbContext db, MemberTradeForRechange model) { if (model.Status == MemberTradeForRechangeStatus.未完成) { var amounts = db.GetMemberAmountList(model.MemberId); model.Status = MemberTradeForRechangeStatus.成功; //现不使用余额 //var totalFee = model.TotalFee; //var amount = amounts.GetSingle(MemberAmountType.可用现金金额); //long OriginalAmount = 0; //if (amount != null) //{ // OriginalAmount = amount.Amount; // amount.Amount += totalFee; //} //else //{ // amount = new MemberAmount(); // amount.Amount = totalFee; // amount.AmountType = MemberAmountType.可用现金金额; // amount.MemberId = model.MemberId; // db.AddToMemberAmount(amount); //} //amounts.Increase(MemberAmountType.累计充值金额, totalFee); //var amountlog = new MemberAmountChangeLog(); //amountlog.AddTime = DateTime.Now; //amountlog.Amount = totalFee; //amountlog.MemberId = model.MemberId; //amountlog.Detail = "在线充值-可用现余额充值"; //amountlog.NowAmount = OriginalAmount + totalFee; //amountlog.OriginalAmount = OriginalAmount; //amountlog.Title = "充值"; //amountlog.Type = FinaceType.充值入账; //db.AddToMemberAmountChangeLog(amountlog); //#region 修改金额缓存 //amounts.UpdateMemberAmountCache(); //#endregion } }
public static MemberTradeForRechange AddToMemberTradeForRechange(this DbContext context, MemberTradeForRechange model) { context.MemberTradeForRechangeDbSet().Add(model); return(model); }