예제 #1
0
        private string GetRemark(CapitalDetailInfo data)
        {
            string result = "";

            if (data == null)
            {
                return(result);
            }
            result = data.SourceType.ToDescription() + "(单号 " + (string.IsNullOrWhiteSpace(data.SourceData) ? data.Id.ToString() : data.SourceData) + ")";
            switch (data.SourceType)
            {
            case CapitalDetailInfo.CapitalDetailType.ChargeAmount:
                if (data.PresentAmount > 0)
                {
                    result = data.SourceType.ToDescription() + ",充" + data.Amount + "送" + data.PresentAmount + "元";
                }
                break;

            case CapitalDetailInfo.CapitalDetailType.Brokerage:
                var remark = data.Remark;
                if (remark.IndexOf(',') > -1)
                {
                    remark = remark.Replace("Id", "号").Split(',')[1];
                }
                result = data.SourceType.ToDescription() + " " + remark;
                break;
            }

            return(result);
        }
예제 #2
0
        /// <summary>
        /// 获取分销备注
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        string GetBrokerageRemark(CapitalDetailInfo data)
        {
            var remark = data.Remark;

            if (remark.IndexOf(',') > -1)
            {
                remark = remark.Replace("Id", "号").Split(',')[1];
            }
            return(data.SourceType.ToDescription() + " " + remark);
        }
        /// <summary>
        /// 佣金转账
        /// </summary>
        /// <param name="member"></param>
        /// <param name="amount"></param>
        /// <param name="remark"></param>
        /// <param name="payNo"></param>
        public static long BrokerageTransfer(long member, decimal amount, string remark, string payNo)
        {
            var capital = Service.GetCapitalInfo(member);
            var detail  = new CapitalDetailInfo
            {
                Amount        = amount,
                CapitalID     = capital.Id,
                PresentAmount = 0,
                Remark        = remark,
                SourceData    = payNo,
                SourceType    = CapitalDetailInfo.CapitalDetailType.Brokerage,
            };

            Service.AddCapital(detail);
            return(detail.Id);
        }
예제 #4
0
        private string GetRemark(CapitalDetailInfo data)
        {
            string result = "";

            if (data == null)
            {
                return(result);
            }
            result = data.SourceType.ToDescription() + "(单号 " + (string.IsNullOrWhiteSpace(data.SourceData) ? data.Id.ToString() : data.SourceData) + ")";
            switch (data.SourceType)
            {
            case CapitalDetailInfo.CapitalDetailType.ChargeAmount:
                if (data.PresentAmount > 0)
                {
                    result = data.SourceType.ToDescription() + ",充" + data.Amount + "送" + data.PresentAmount + "元";
                }
                break;
            }

            return(result);
        }
예제 #5
0
        public void AddCapital(CapitalDetailInfo detail)
        {
            detail.Id         = CreateCode(detail.SourceType);
            detail.CreateTime = DateTime.Now;
            DbFactory.Default.InTransaction(() =>
            {
                DbFactory.Default.Add(detail);
                //根据 detail.SourceType 进行处理
                switch (detail.SourceType)
                {
                case CapitalDetailInfo.CapitalDetailType.ChargeAmount:
                case CapitalDetailInfo.CapitalDetailType.Brokerage:
                    var change = detail.Amount;
                    DbFactory.Default.Set <CapitalInfo>()
                    .Where(p => p.Id == detail.CapitalID)
                    .Set(p => p.Balance, n => n.Balance + change)    //变更数值已包含正负符号
                    .Succeed();
                    break;

                default:
                    throw new MallException("未能处理当前业务类型");
                }
            });
        }
예제 #6
0
        public void AddCapital(CapitalDetailModel model)
        {
            Log.Debug("AddCapital:" + model.UserId);
            var           capital      = Context.CapitalInfo.FirstOrDefault(e => e.MemId == model.UserId);
            decimal       balance      = 0;
            decimal       chargeAmount = 0;
            decimal       freezeAmount = 0;
            StringBuilder strBuilder   = new StringBuilder();

            //备注、支付方式保存到remark
            strBuilder.Append(model.Remark);
            strBuilder.Append(" ");
            strBuilder.Append(model.PayWay);
            switch (model.SourceType)
            {
            case CapitalDetailInfo.CapitalDetailType.ChargeAmount:
                balance = chargeAmount = model.Amount;
                break;

            case CapitalDetailInfo.CapitalDetailType.WithDraw:
                freezeAmount = model.Amount;
                break;

            default:
                balance = model.Amount;
                break;
            }
            if (capital == null)
            {
                capital = new CapitalInfo
                {
                    MemId                = model.UserId,
                    Balance              = balance,
                    ChargeAmount         = chargeAmount,
                    FreezeAmount         = freezeAmount,
                    Himall_CapitalDetail = new List <CapitalDetailInfo> {
                        new CapitalDetailInfo {
                            Id         = CreateCode(model.SourceType),
                            Amount     = balance,
                            CreateTime = DateTime.Parse(model.CreateTime),
                            SourceType = model.SourceType,
                            SourceData = model.SourceData,
                            Remark     = strBuilder.ToString()
                        }
                    }
                };
                Context.CapitalInfo.Add(capital);
            }
            else
            {
                var capitalDetail = Context.CapitalDetailInfo.FirstOrDefault(e => e.Id == model.Id && e.Id != 0);
                if (capitalDetail == null)
                {
                    capitalDetail = new CapitalDetailInfo()
                    {
                        Id         = CreateCode(model.SourceType),
                        Amount     = model.Amount,
                        CreateTime = DateTime.Parse(model.CreateTime),
                        CapitalID  = capital.Id,
                        SourceType = model.SourceType,
                        SourceData = model.SourceData,
                        Remark     = strBuilder.ToString()
                    };
                    Context.CapitalDetailInfo.Add(capitalDetail);
                    capital.Balance      += balance;
                    capital.ChargeAmount += chargeAmount;
                    capital.FreezeAmount += freezeAmount;
                }
            }
            Context.SaveChanges();
        }
예제 #7
0
        /// <summary>
        /// 获取用户奖励明细
        /// </summary>
        /// <param name="detailId"></param>
        /// <returns></returns>
        public object GetCapitalDetailInfo(long id)
        {
            CheckUserLogin();
            if (CurrentUser != null)
            {
                IMemberCapitalService _iMemberCapitalService = ServiceProvider.Instance <IMemberCapitalService> .Create;
                CapitalDetailInfo     detail = _iMemberCapitalService.GetCapitalDetailInfo(id);
                if (detail != null)
                {
                    decimal amount      = 0;  // 金额,提现、奖励、消费均有
                    var     shopName    = ""; //商家名称,奖励、消费均有
                    var     productName = ""; //商品名称,奖励有
                    var     typeName    = ""; //类别名称,提现、奖励、消费均有
                    var     orderNum    = ""; //单据编号,提现、奖励、消费均有
                    var     orderTime   = ""; //单据时间,提现、奖励、消费均有
                    var     status      = ""; //状态,提现有

                    amount    = detail.Amount;
                    typeName  = detail.SourceType.ToDescription();
                    orderNum  = detail.SourceData;
                    orderTime = ((DateTime)detail.CreateTime).ToString("yyyy/MM/dd HH:mm");

                    if (detail.SourceType == CapitalDetailInfo.CapitalDetailType.WithDraw)
                    {
                        status = _iMemberCapitalService.GetWithDraw(Convert.ToInt64(detail.SourceData)).ApplyStatus.ToDescription();
                        var data = new
                        {
                            Amount      = amount,
                            ShopName    = shopName,
                            ProductName = productName,
                            TypeName    = typeName,
                            OrderNum    = orderNum,
                            OrderTime   = orderTime,
                            Status      = status
                        };

                        return(Json(new { Success = true, Data = data }));
                    }
                    else
                    {
                        var order = ServiceProvider.Instance <IOrderService> .Create.GetOrder(Convert.ToInt64(detail.SourceData));

                        if (order != null)
                        {
                            var product = ServiceProvider.Instance <IProductService> .Create.GetProduct(order.OrderItemInfo.FirstOrDefault().ProductId);

                            var data = new
                            {
                                Amount      = amount,
                                ShopName    = order.ShopName,
                                ProductName = product.ProductName,
                                TypeName    = typeName,
                                OrderNum    = orderNum,
                                OrderTime   = orderTime,
                                Status      = status
                            };

                            return(Json(new { Success = true, Data = data }));
                        }
                        else
                        {
                            return(Json(new { Success = false, Message = "订单数据异常" }));
                        }
                    }
                }
                else
                {
                    return(Json(new { Success = false, Message = "未查到相关数据" }));
                }
            }
            else
            {
                return(Json(new { Success = false, Message = "未登录" }));
            }
        }
예제 #8
0
        public void AddCapital(CapitalDetailModel model)
        {
            decimal?      nullable;
            decimal?      nullable1;
            decimal?      nullable2;
            CapitalInfo   capitalInfo   = context.CapitalInfo.FirstOrDefault((CapitalInfo e) => e.MemId == model.UserId);
            decimal       num           = new decimal(0);
            decimal       num1          = new decimal(0);
            decimal       amount        = new decimal(0);
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(model.Remark);
            stringBuilder.Append(" ");
            stringBuilder.Append(model.PayWay);
            switch (model.SourceType)
            {
            case CapitalDetailInfo.CapitalDetailType.ChargeAmount:
            {
                decimal amount1 = model.Amount;
                num1 = amount1;
                num  = amount1;
                break;
            }

            case CapitalDetailInfo.CapitalDetailType.WithDraw:
            {
                amount = model.Amount;
                break;
            }

            default:
            {
                num = model.Amount;
                break;
            }
            }
            if (capitalInfo == null)
            {
                CapitalInfo capitalInfo1 = new CapitalInfo()
                {
                    MemId        = model.UserId,
                    Balance      = new decimal?(num),
                    ChargeAmount = new decimal?(num1),
                    FreezeAmount = new decimal?(amount)
                };
                List <CapitalDetailInfo> capitalDetailInfos = new List <CapitalDetailInfo>();
                CapitalDetailInfo        capitalDetailInfo  = new CapitalDetailInfo()
                {
                    Id         = CreateCode(model.SourceType),
                    Amount     = num,
                    CreateTime = new DateTime?(DateTime.Parse(model.CreateTime)),
                    SourceType = model.SourceType,
                    SourceData = model.SourceData,
                    Remark     = stringBuilder.ToString()
                };
                capitalDetailInfos.Add(capitalDetailInfo);
                capitalInfo1.ChemCloud_CapitalDetail = capitalDetailInfos;
                capitalInfo = capitalInfo1;
                context.CapitalInfo.Add(capitalInfo);
            }
            else if (context.CapitalDetailInfo.FirstOrDefault((CapitalDetailInfo e) => e.Id == model.Id && e.Id != 0) == null)
            {
                CapitalDetailInfo capitalDetailInfo1 = new CapitalDetailInfo()
                {
                    Id         = CreateCode(model.SourceType),
                    Amount     = model.Amount,
                    CreateTime = new DateTime?(DateTime.Parse(model.CreateTime)),
                    CapitalID  = capitalInfo.Id,
                    SourceType = model.SourceType,
                    SourceData = model.SourceData,
                    Remark     = stringBuilder.ToString()
                };
                context.CapitalDetailInfo.Add(capitalDetailInfo1);
                CapitalInfo capitalInfo2 = capitalInfo;
                decimal?    balance      = capitalInfo2.Balance;
                decimal     num2         = num;
                if (balance.HasValue)
                {
                    nullable = new decimal?(balance.GetValueOrDefault() + num2);
                }
                else
                {
                    nullable = null;
                }
                capitalInfo2.Balance = nullable;
                CapitalInfo capitalInfo3 = capitalInfo;
                decimal?    chargeAmount = capitalInfo3.ChargeAmount;
                decimal     num3         = num1;
                if (chargeAmount.HasValue)
                {
                    nullable1 = new decimal?(chargeAmount.GetValueOrDefault() + num3);
                }
                else
                {
                    nullable1 = null;
                }
                capitalInfo3.ChargeAmount = nullable1;
                CapitalInfo capitalInfo4 = capitalInfo;
                decimal?    freezeAmount = capitalInfo4.FreezeAmount;
                decimal     num4         = amount;
                if (freezeAmount.HasValue)
                {
                    nullable2 = new decimal?(freezeAmount.GetValueOrDefault() + num4);
                }
                else
                {
                    nullable2 = null;
                }
                capitalInfo4.FreezeAmount = nullable2;
            }
            context.SaveChanges();
        }
예제 #9
0
        public void AddCapital(CapitalDetailModel model, bool isAccrualRecharge = true)
        {
            //var capital = Context.CapitalInfo.FirstOrDefault(e => e.MemId == model.UserId);
            var     capital       = DbFactory.Default.Get <CapitalInfo>().Where(e => e.MemId == model.UserId).FirstOrDefault();
            decimal balance       = 0;
            decimal presentAmount = 0;

            //充值赠送
            if (model.PresentAmount.HasValue && model.PresentAmount > 0)
            {
                presentAmount = model.PresentAmount.Value;
            }
            decimal       chargeAmount = model.Amount;
            decimal       freezeAmount = 0;
            StringBuilder strBuilder   = new StringBuilder();

            if (presentAmount > 0)
            {
                strBuilder.Append("充" + model.Amount + "元赠送" + presentAmount + "元");
            }
            else
            {
                //备注、支付方式保存到remark
                //strBuilder.Append(model.PayWay);//BUG 40384
                //strBuilder.Append(" ");
                strBuilder.Append(model.Remark);
            }
            switch (model.SourceType)
            {
            case CapitalDetailInfo.CapitalDetailType.ChargeAmount:
                balance = chargeAmount + presentAmount;
                break;

            case CapitalDetailInfo.CapitalDetailType.WithDraw:
                freezeAmount = model.Amount;
                break;

            default:
                balance = chargeAmount + presentAmount;
                break;
            }
            if (capital == null)
            {
                capital = new CapitalInfo
                {
                    MemId         = model.UserId,
                    Balance       = balance,
                    ChargeAmount  = chargeAmount,
                    FreezeAmount  = freezeAmount,
                    PresentAmount = presentAmount
                };
                if (!isAccrualRecharge)
                {
                    capital.ChargeAmount = 0;
                }
                DbFactory.Default.Add(capital);
                var capitalDetail = new CapitalDetailInfo
                {
                    Id            = CreateCode(model.SourceType),
                    CapitalID     = capital.Id,
                    Amount        = balance,
                    PresentAmount = presentAmount,
                    CreateTime    = DateTime.Parse(model.CreateTime),
                    SourceType    = model.SourceType,
                    SourceData    = model.SourceData,
                    Remark        = strBuilder.ToString()
                };
                DbFactory.Default.Add(capitalDetail);
                if (string.IsNullOrWhiteSpace(capitalDetail.SourceData) &&
                    capitalDetail.SourceType == CapitalDetailInfo.CapitalDetailType.ChargeAmount &&
                    model.PayWay == "管理员操作")
                {
                    capitalDetail.SourceData = capitalDetail.Id.ToString();
                    DbFactory.Default.Update(capitalDetail);
                }
            }
            else
            {
                var capitalDetail = DbFactory.Default.Get <CapitalDetailInfo>().Where(e => e.Id == model.Id && e.Id != 0).FirstOrDefault();
                if (capitalDetail == null)
                {
                    capitalDetail = new CapitalDetailInfo()
                    {
                        Id            = CreateCode(model.SourceType),
                        Amount        = model.Amount,
                        PresentAmount = model.PresentAmount.HasValue ? model.PresentAmount.Value : 0,
                        CreateTime    = DateTime.Parse(model.CreateTime),
                        CapitalID     = capital.Id,
                        SourceType    = model.SourceType,
                        SourceData    = model.SourceData,
                        Remark        = strBuilder.ToString()
                    };
                    DbFactory.Default.Add(capitalDetail);
                    if (string.IsNullOrWhiteSpace(capitalDetail.SourceData) &&
                        capitalDetail.SourceType == CapitalDetailInfo.CapitalDetailType.ChargeAmount &&
                        model.PayWay == "管理员操作")
                    {
                        capitalDetail.SourceData = capitalDetail.Id.ToString();
                        DbFactory.Default.Update(capitalDetail);
                    }
                    capital.Balance       += balance;
                    capital.PresentAmount += presentAmount;

                    if (isAccrualRecharge)
                    {
                        capital.ChargeAmount += chargeAmount;
                    }
                    capital.FreezeAmount += freezeAmount;
                    DbFactory.Default.Update(capital);
                }
            }
        }
예제 #10
0
        public void ConfirmRefund(long refundId, string managerRemark, string managerName)
        {
            decimal?        nullable;
            OrderRefundInfo now = context.OrderRefundInfo.FindById <OrderRefundInfo>(refundId);

            if (now.RefundPayType.HasValue)
            {
                switch (now.RefundPayType.Value)
                {
                case OrderRefundInfo.OrderRefundPayType.BackOut:
                {
                    if (now.RefundPayStatus.HasValue && now.RefundPayStatus.Value == OrderRefundInfo.OrderRefundPayStatus.PaySuccess)
                    {
                        break;
                    }
                    string paymentTypeGateway = now.OrderItemInfo.OrderInfo.PaymentTypeGateway;
                    IEnumerable <Plugin <IPaymentPlugin> > plugins =
                        from item in PluginsManagement.GetPlugins <IPaymentPlugin>(true)
                        where item.PluginInfo.PluginId == paymentTypeGateway
                        select item;
                    if (plugins.Count <Plugin <IPaymentPlugin> >() <= 0)
                    {
                        throw new HimallException("退款时,未找到支付方式!");
                    }
                    OrderPayInfo      orderPayInfo = context.OrderPayInfo.FirstOrDefault((OrderPayInfo e) => e.PayState && e.OrderId == now.OrderId);
                    IQueryable <long> nums         =
                        from item in context.OrderPayInfo
                        where item.PayId == orderPayInfo.PayId && item.PayState
                        select item into e
                        select e.OrderId;
                    decimal num = (
                        from o in context.OrderInfo
                        where nums.Contains(o.Id)
                        select o).ToList().Sum <OrderInfo>((OrderInfo e) => e.OrderTotalAmount);
                    if (orderPayInfo == null)
                    {
                        throw new HimallException("退款时,未找到原支付订单信息!");
                    }
                    PaymentPara paymentPara = new PaymentPara()
                    {
                        out_refund_no = now.Id.ToString(),
                        out_trade_no  = orderPayInfo.PayId.ToString(),
                        refund_fee    = now.Amount,
                        total_fee     = num
                    };
                    PaymentPara paymentPara1 = paymentPara;
                    PaymentInfo paymentInfo  = plugins.FirstOrDefault <Plugin <IPaymentPlugin> >().Biz.ProcessRefundFee(paymentPara1);
                    if (paymentInfo.OrderIds == null || paymentInfo.OrderIds.Count() <= 0)
                    {
                        break;
                    }
                    now.RefundPayStatus = new OrderRefundInfo.OrderRefundPayStatus?(OrderRefundInfo.OrderRefundPayStatus.PaySuccess);
                    context.SaveChanges();
                    break;
                }

                case OrderRefundInfo.OrderRefundPayType.BackCapital:
                {
                    if (now.RefundPayStatus.HasValue && now.RefundPayStatus.Value == OrderRefundInfo.OrderRefundPayStatus.PaySuccess)
                    {
                        break;
                    }
                    CapitalInfo capitalInfo = context.CapitalInfo.FirstOrDefault((CapitalInfo e) => e.MemId == now.UserId);
                    OrderBO     orderBO     = new OrderBO();
                    if (capitalInfo != null)
                    {
                        CapitalDetailInfo capitalDetailInfo = new CapitalDetailInfo()
                        {
                            Amount     = now.Amount,
                            CapitalID  = capitalInfo.Id,
                            CreateTime = new DateTime?(DateTime.Now),
                            SourceType = CapitalDetailInfo.CapitalDetailType.Refund,
                            SourceData = now.Id.ToString(),
                            Id         = orderBO.GenerateOrderNumber()
                        };
                        CapitalDetailInfo capitalDetailInfo1 = capitalDetailInfo;
                        CapitalInfo       capitalInfo1       = capitalInfo;
                        decimal?          balance            = capitalInfo1.Balance;
                        decimal           amount             = now.Amount;
                        if (balance.HasValue)
                        {
                            nullable = new decimal?(balance.GetValueOrDefault() + amount);
                        }
                        else
                        {
                            nullable = null;
                        }
                        capitalInfo1.Balance = nullable;
                        context.CapitalDetailInfo.Add(capitalDetailInfo1);
                    }
                    else
                    {
                        CapitalInfo capitalInfo2 = new CapitalInfo()
                        {
                            Balance      = new decimal?(now.Amount),
                            MemId        = now.UserId,
                            FreezeAmount = new decimal?(new decimal(0)),
                            ChargeAmount = new decimal?(new decimal(0))
                        };
                        List <CapitalDetailInfo> capitalDetailInfos = new List <CapitalDetailInfo>();
                        CapitalDetailInfo        capitalDetailInfo2 = new CapitalDetailInfo()
                        {
                            Amount     = now.Amount,
                            CreateTime = new DateTime?(DateTime.Now),
                            SourceData = now.Id.ToString(),
                            SourceType = CapitalDetailInfo.CapitalDetailType.Refund,
                            Id         = orderBO.GenerateOrderNumber()
                        };
                        capitalDetailInfos.Add(capitalDetailInfo2);
                        capitalInfo2.ChemCloud_CapitalDetail = capitalDetailInfos;
                        capitalInfo = capitalInfo2;
                        context.CapitalInfo.Add(capitalInfo);
                    }
                    now.RefundPayStatus = new OrderRefundInfo.OrderRefundPayStatus?(OrderRefundInfo.OrderRefundPayStatus.PaySuccess);
                    context.SaveChanges();
                    break;
                }
                }
            }
            if (now.ManagerConfirmStatus != OrderRefundInfo.OrderRefundConfirmStatus.UnConfirm)
            {
                throw new HimallException("只有未确认状态的退款/退货才能进行确认操作");
            }
            now.ManagerConfirmStatus = OrderRefundInfo.OrderRefundConfirmStatus.Confirmed;
            now.ManagerConfirmDate   = DateTime.Now;
            now.ManagerRemark        = managerRemark;
            OrderOperationLogInfo orderOperationLogInfo = new OrderOperationLogInfo()
            {
                Operator       = managerName,
                OrderId        = now.OrderId,
                OperateDate    = DateTime.Now,
                OperateContent = "确认退款/退货"
            };

            context.OrderOperationLogInfo.Add(orderOperationLogInfo);
            UserMemberInfo userMemberInfo   = context.UserMemberInfo.FindById <UserMemberInfo>(now.UserId);
            OrderInfo      orderInfo        = context.OrderInfo.FindById <OrderInfo>(now.OrderId);
            decimal        orderTotalAmount = orderInfo.OrderTotalAmount - orderInfo.Freight;
            decimal        amount1          = now.Amount - (orderInfo.IntegralDiscount * (now.Amount / orderTotalAmount));

            amount1 = Math.Round(amount1, 2);
            if (amount1 > new decimal(0))
            {
                OrderInfo refundTotalAmount = orderInfo;
                refundTotalAmount.RefundTotalAmount = refundTotalAmount.RefundTotalAmount + amount1;
                if (orderInfo.RefundTotalAmount > orderTotalAmount)
                {
                    orderInfo.RefundTotalAmount = orderTotalAmount;
                }
            }
            if (now.RefundMode != OrderRefundInfo.OrderRefundMode.OrderRefund)
            {
                MemberIntegralExchangeRules integralChangeRule = Instance <IMemberIntegralService> .Create.GetIntegralChangeRule();

                if (integralChangeRule != null)
                {
                    int            moneyPerIntegral = integralChangeRule.MoneyPerIntegral;
                    int            num1             = (int)Math.Floor(now.Amount / moneyPerIntegral);
                    MemberIntegral memberIntegral   = userMemberInfo.ChemCloud_MemberIntegral.FirstOrDefault();
                    int            num2             = (memberIntegral == null ? 0 : memberIntegral.AvailableIntegrals);
                    if (num1 > 0 && num2 > 0 && orderInfo.OrderStatus == OrderInfo.OrderOperateStatus.Finish)
                    {
                        MemberIntegralRecord memberIntegralRecord = new MemberIntegralRecord()
                        {
                            UserName   = userMemberInfo.UserName,
                            MemberId   = userMemberInfo.Id,
                            RecordDate = new DateTime?(DateTime.Now),
                            TypeId     = MemberIntegral.IntegralType.Others
                        };
                        object[] id = new object[] { "售后编号【", now.Id, "】退款应扣除积分", num1.ToString() };
                        memberIntegralRecord.ReMark = string.Concat(id);
                        num1 = (num1 > num2 ? num2 : num1);
                        num1 = -num1;
                        IConversionMemberIntegralBase conversionMemberIntegralBase = Instance <IMemberIntegralConversionFactoryService> .Create.Create(MemberIntegral.IntegralType.Others, num1);

                        Instance <IMemberIntegralService> .Create.AddMemberIntegral(memberIntegralRecord, conversionMemberIntegralBase);
                    }
                }
            }
            context.SaveChanges();
            MessageOrderInfo messageOrderInfo = new MessageOrderInfo()
            {
                OrderId     = orderInfo.Id.ToString(),
                ShopId      = orderInfo.ShopId,
                ShopName    = orderInfo.ShopName,
                RefundMoney = now.Amount,
                SiteName    = Instance <ISiteSettingService> .Create.GetSiteSettings().SiteName,
                TotalMoney  = orderInfo.OrderTotalAmount
            };

            Task.Factory.StartNew(() => Instance <IMessageService> .Create.SendMessageOnOrderRefund(orderInfo.UserId, messageOrderInfo));
            if (orderInfo.PayDate.HasValue)
            {
                UpdateShopVisti(now, orderInfo.PayDate.Value);
                UpdateProductVisti(now, orderInfo.PayDate.Value);
            }
        }