예제 #1
0
        public static void SetMemberTradeForRefundSuccess(this DbContext db, MemberTradeForRefund model)
        {
            if (model.Status == MemberTradeForRefundStatus.退款中)
            {
                var amounts = db.GetMemberAmountList(model.MemberId);

                model.Status = MemberTradeForRefundStatus.成功;
                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
            }
        }
예제 #2
0
 public virtual void AddToMemberAmountChangeLog(MemberAmountChangeLog log)
 {
     db.AddToMemberAmountChangeLog(log);
 }