private void AddMarketServiceRecord(long msId, DateTime start, DateTime end)
        {
            DbSet <MarketServiceRecordInfo> marketServiceRecordInfo  = context.MarketServiceRecordInfo;
            MarketServiceRecordInfo         marketServiceRecordInfo1 = new MarketServiceRecordInfo()
            {
                MarketServiceId = msId,
                EndTime         = end,
                StartTime       = start
            };

            marketServiceRecordInfo.Add(marketServiceRecordInfo1);
        }
示例#2
0
        public void OrderMarketService(int monthCount, long shopId, MarketType type)
        {
            if (shopId <= 0)
            {
                throw new HimallException("ShopId不能识别");
            }
            if (monthCount <= 0)
            {
                throw new HimallException("购买服务时长必须大于零");
            }
            ShopInfo shopInfo = context.ShopInfo.FindById <ShopInfo>(shopId);

            if (shopInfo == null || shopId <= 0)
            {
                throw new HimallException("ShopId不能识别");
            }
            ActiveMarketServiceInfo activeMarketServiceInfo = context.ActiveMarketServiceInfo.FirstOrDefault((ActiveMarketServiceInfo a) => a.ShopId == shopId && (int)a.TypeId == (int)type);

            if (activeMarketServiceInfo == null)
            {
                DbSet <ActiveMarketServiceInfo> activeMarketServiceInfos = context.ActiveMarketServiceInfo;
                ActiveMarketServiceInfo         activeMarketServiceInfo1 = new ActiveMarketServiceInfo()
                {
                    ShopId   = shopId,
                    ShopName = shopInfo.ShopName,
                    TypeId   = type
                };
                List <MarketServiceRecordInfo> marketServiceRecordInfos = new List <MarketServiceRecordInfo>();
                MarketServiceRecordInfo        marketServiceRecordInfo  = new MarketServiceRecordInfo()
                {
                    StartTime = DateTime.Now.Date,
                    EndTime   = DateTime.Now.AddMonths(monthCount)
                };
                marketServiceRecordInfos.Add(marketServiceRecordInfo);
                activeMarketServiceInfo1.MarketServiceRecordInfo = marketServiceRecordInfos;
                activeMarketServiceInfos.Add(activeMarketServiceInfo1);
            }
            else
            {
                DateTime dateTime = activeMarketServiceInfo.MarketServiceRecordInfo.Max <MarketServiceRecordInfo, DateTime>((MarketServiceRecordInfo item) => item.EndTime);
                ICollection <MarketServiceRecordInfo> marketServiceRecordInfo1 = activeMarketServiceInfo.MarketServiceRecordInfo;
                MarketServiceRecordInfo marketServiceRecordInfo2 = new MarketServiceRecordInfo()
                {
                    StartTime = dateTime,
                    EndTime   = dateTime.AddMonths(monthCount)
                };
                marketServiceRecordInfo1.Add(marketServiceRecordInfo2);
            }
            context.SaveChanges();
        }
        private static MarketServicesRecord ConvertToMarketServicesRecord(MarketServiceRecordInfo info)
        {
            MarketServicesRecord record = null;

            if (info != null)
            {
                record             = new MarketServicesRecord();
                record.BuyTime     = info.BuyTime.ToString("yyyy-MM-dd HH:mm:ss");
                record.BuyingCycle = info.StartTime.ToString("yyyy-MM-dd HH:mm:ss") + "至" + info.EndTime.ToString("yyyy-MM-dd HH:mm:ss");
                record.MarketType  = (info.ActiveMarketServiceInfo.TypeId).ToDescription();
                record.Price       = info.Price;
                record.ShopId      = info.ActiveMarketServiceInfo.ShopId;
                record.ShopName    = info.ActiveMarketServiceInfo.ShopName;
            }
            return(record);
        }
        public void EnableMarketService(int monthCount, long shopId)
        {
            if (shopId <= 0)
            {
                throw new HimallException("ShopId不能识别");
            }
            if (monthCount <= 0)
            {
                throw new HimallException("购买服务时长必须大于零");
            }
            ShopInfo shopInfo = context.ShopInfo.FindById <ShopInfo>(shopId);

            if (shopInfo == null || shopId <= 0)
            {
                throw new HimallException("ShopId不能识别");
            }
            if (!context.ActiveMarketServiceInfo.Any((ActiveMarketServiceInfo a) => a.ShopId == shopId && (int)a.TypeId == 1))
            {
                DbSet <ActiveMarketServiceInfo> activeMarketServiceInfo  = context.ActiveMarketServiceInfo;
                ActiveMarketServiceInfo         activeMarketServiceInfo1 = new ActiveMarketServiceInfo()
                {
                    ShopId   = shopId,
                    ShopName = shopInfo.ShopName,
                    TypeId   = MarketType.LimitTimeBuy
                };
                List <MarketServiceRecordInfo> marketServiceRecordInfos = new List <MarketServiceRecordInfo>();
                MarketServiceRecordInfo        marketServiceRecordInfo  = new MarketServiceRecordInfo()
                {
                    StartTime = DateTime.Now.Date,
                    EndTime   = DateTime.Now.Date.AddMonths(monthCount)
                };
                marketServiceRecordInfos.Add(marketServiceRecordInfo);
                activeMarketServiceInfo1.MarketServiceRecordInfo = marketServiceRecordInfos;
                activeMarketServiceInfo.Add(activeMarketServiceInfo1);
            }
            else
            {
                ActiveMarketServiceInfo activeMarketServiceInfo2 = context.ActiveMarketServiceInfo.FirstOrDefault((ActiveMarketServiceInfo a) => a.ShopId == shopId && (int)a.TypeId == 1);
                long     id       = activeMarketServiceInfo2.Id;
                DateTime date     = DateTime.Now.Date;
                DateTime dateTime = DateTime.Now.Date;
                AddMarketServiceRecord(id, date, dateTime.AddMonths(monthCount));
            }
            context.SaveChanges();
        }
示例#5
0
        public void OrderMarketService(int monthCount, long shopId, MarketType type)
        {
            if (shopId <= 0)
            {
                throw new HimallException("ShopId不能识别");
            }
            if (monthCount <= 0)
            {
                throw new HimallException("购买服务时长必须大于零");
            }
            var shop = Context.ShopInfo.FindById(shopId);

            if (shop == null || shopId <= 0)
            {
                throw new HimallException("ShopId不能识别");
            }
            var market    = Context.ActiveMarketServiceInfo.Where(a => a.ShopId == shopId && a.TypeId == type).FirstOrDefault();
            var price     = Context.MarketSettingInfo.Where(a => a.TypeId == type).Select(a => a.Price).FirstOrDefault();
            var StartTime = DateTime.Now;
            MarketServiceRecordInfo model = new MarketServiceRecordInfo();

            model.StartTime = StartTime;
            model.Price     = price * monthCount;
            var shopAccount = Context.ShopAccountInfo.Where(a => a.ShopId == shopId).FirstOrDefault(); //店铺帐户信息

            if (shopAccount.Balance < model.Price)                                                     //店铺余额不足以支付服务费用
            {
                throw new HimallException("您的店铺余额为:" + shopAccount.Balance + "元,不足以支付此次营销服务购买费用,请先充值。");
            }
            if (market != null)
            {
                var maxTime = market.MarketServiceRecordInfo.Max(a => a.EndTime);
                if (maxTime > DateTime.Now) //如果结束时间大于当前时间,续费从结束时间加上购买月数,否则从当前时间加上购买月数
                {
                    StartTime = maxTime;
                }
                model.StartTime = StartTime;
                model.BuyTime   = DateTime.Now;
                model.EndTime   = StartTime.AddMonths(monthCount);
                // model.MarketServiceId = market.Id;
                model.SettlementFlag = 1;
                market.MarketServiceRecordInfo.Add(model);
            }
            else
            {
                model.StartTime      = StartTime;
                model.EndTime        = StartTime.AddMonths(monthCount);
                model.SettlementFlag = 1;
                model.BuyTime        = DateTime.Now;
                ActiveMarketServiceInfo activeMarketServiceInfo = new Model.ActiveMarketServiceInfo();
                activeMarketServiceInfo.ShopId   = shopId;
                activeMarketServiceInfo.ShopName = shop.ShopName;
                activeMarketServiceInfo.TypeId   = type;
                activeMarketServiceInfo.MarketServiceRecordInfo.Add(model);
                Context.ActiveMarketServiceInfo.Add(activeMarketServiceInfo);
            }
            Context.SaveChanges();
            var ShopAccount          = Context.ShopAccountInfo.FirstOrDefault(a => a.ShopId == shopId);
            ShopAccountItemInfo info = new ShopAccountItemInfo();

            info.IsIncome        = false;
            info.ShopId          = shopId;
            info.DetailId        = model.Id.ToString();
            info.ShopName        = shop.ShopName;
            info.AccountNo       = shopId + info.DetailId + new Random().Next(10000);
            info.ReMark          = "店铺购买" + type.ToDescription() + "服务," + monthCount + "个月";
            info.TradeType       = CommonModel.ShopAccountType.MarketingServices;
            info.CreateTime      = DateTime.Now;
            info.Amount          = price * monthCount;
            info.AccoutID        = ShopAccount.Id;
            ShopAccount.Balance -= info.Amount;         //总余额减钱
            info.Balance         = ShopAccount.Balance; //变动后当前剩余金额
            Context.ShopAccountItemInfo.Add(info);
            var PlatAccount           = Context.PlatAccountInfo.FirstOrDefault();
            PlatAccountItemInfo pinfo = new PlatAccountItemInfo();

            pinfo.IsIncome       = true;
            pinfo.DetailId       = model.Id.ToString();
            pinfo.AccountNo      = info.AccountNo;
            pinfo.ReMark         = "店铺购买" + type.ToDescription() + "服务," + monthCount + "个月";
            pinfo.TradeType      = CommonModel.PlatAccountType.MarketingServices;
            pinfo.CreateTime     = DateTime.Now;
            pinfo.Amount         = price * monthCount;
            pinfo.AccoutID       = PlatAccount.Id;
            PlatAccount.Balance += info.Amount;  //总余额加钱

            pinfo.Balance = PlatAccount.Balance; //变动后当前剩余金额
            Context.PlatAccountItemInfo.Add(pinfo);
            Context.SaveChanges();
        }
示例#6
0
        private void CalculationMoney(DateTime startDate, DateTime endDate)
        {
            DateTime?finishDate;

            string[] str;
            Entities entity = new Entities();
            var      list   = (
                from p in entity.OrderInfo
                join o in entity.OrderRefundInfo on p.Id equals o.OrderId
                join x in entity.OrderItemInfo on o.OrderId equals x.OrderId
                where (int)p.OrderStatus == 5 && (o.ManagerConfirmDate >= startDate) && (o.ManagerConfirmDate < endDate) && (int)o.ManagerConfirmStatus == 7
                select new { Order = p, OrderRefund = o, OrderItem = x }).Distinct().ToList();
            var collection = (
                from p in entity.OrderInfo
                join o in entity.OrderItemInfo on p.Id equals o.OrderId
                where (int)p.OrderStatus == 5 && (p.FinishDate >= startDate) && (p.FinishDate < endDate)
                select new { Order = p, OrderItem = o }).ToList();
            List <long> nums = new List <long>();

            nums.AddRange(
                from c in list
                select c.Order.ShopId);
            nums.AddRange(
                from c in collection
                select c.Order.ShopId);
            nums = nums.Distinct <long>().ToList();
            //using (TransactionScope transactionScope = new TransactionScope())
            //{
            //    try
            //    {
            //        foreach (long num in nums)
            //        {
            //            List<OrderInfo> orderInfos = (
            //                from c in collection
            //                where c.Order.ShopId == num
            //                select c.Order).Distinct<OrderInfo>().ToList();
            //            decimal num1 = orderInfos.Sum<OrderInfo>((OrderInfo c) => c.ProductTotalAmount) - orderInfos.Sum<OrderInfo>((OrderInfo c) => c.DiscountAmount);
            //            decimal num2 = orderInfos.Sum<OrderInfo>((OrderInfo c) => c.Freight);
            //            decimal num3 = CalculationTotalCommission((
            //                from c in collection
            //                where c.Order.ShopId == num
            //                select c.OrderItem).Distinct<OrderItemInfo>().ToList());
            //            decimal num4 = CalculationTotalRefundCommission((
            //                from c in list
            //                where c.OrderRefund.ShopId == num
            //                select c.OrderItem).Distinct<OrderItemInfo>().ToList());
            //            decimal num5 = (
            //                from c in list
            //                where c.OrderRefund.ShopId == num
            //                select c.OrderRefund).Distinct<OrderRefundInfo>().Sum<OrderRefundInfo>((OrderRefundInfo c) => c.Amount);
            //            decimal num6 = (((num1 + num2) - num3) - num5) + num4;
            //            AccountInfo accountInfo = new AccountInfo()
            //            {
            //                ShopId = num,
            //                ShopName = (
            //                    from c in entity.ShopInfo
            //                    where c.Id == num
            //                    select c).FirstOrDefault().ShopName,
            //                AccountDate = DateTime.Now,
            //                FinishDate=DateTime.Now,
            //                StartDate = startDate,
            //                EndDate = endDate.AddSeconds(-1),
            //                Status = AccountInfo.AccountStatus.UnAccount,
            //                ProductActualPaidAmount = num1,
            //                FreightAmount = num2,
            //                CommissionAmount = num3,
            //                RefundCommissionAmount = num4,
            //                RefundAmount = num5,
            //                PeriodSettlement = num6,
            //                Remark = string.Empty
            //            };
            //            entity.AccountInfo.Add(accountInfo);
            //            foreach (OrderInfo orderInfo in (
            //                from c in list
            //                where c.Order.ShopId == num
            //                select c.Order).Distinct<OrderInfo>().ToList())
            //            {
            //                AccountDetailInfo accountDetailInfo = new AccountDetailInfo()
            //                {
            //                    Himall_Accounts = accountInfo,
            //                    ShopId = orderInfo.ShopId
            //                };
            //                finishDate = orderInfo.FinishDate;
            //                accountDetailInfo.Date = finishDate.Value;
            //                accountDetailInfo.OrderType = AccountDetailInfo.EnumOrderType.ReturnOrder;
            //                accountDetailInfo.OrderId = orderInfo.Id;
            //                accountDetailInfo.ProductActualPaidAmount = orderInfo.ProductTotalAmount - orderInfo.DiscountAmount;
            //                accountDetailInfo.FreightAmount = orderInfo.Freight;
            //                accountDetailInfo.CommissionAmount = CalculationTotalCommission((
            //                    from c in list
            //                    where c.OrderRefund.OrderId == orderInfo.Id
            //                    select c.OrderItem).Distinct<OrderItemInfo>().ToList());
            //                accountDetailInfo.RefundCommisAmount = CalculationTotalRefundCommission((
            //                    from c in list
            //                    where c.OrderRefund.OrderId == orderInfo.Id
            //                    select c.OrderItem).Distinct<OrderItemInfo>().ToList());
            //                accountDetailInfo.RefundTotalAmount = (
            //                    from c in list
            //                    where c.OrderRefund.OrderId == orderInfo.Id
            //                    select c.OrderRefund).Distinct<OrderRefundInfo>().Sum<OrderRefundInfo>((OrderRefundInfo c) => c.Amount);
            //                accountDetailInfo.OrderDate = orderInfo.OrderDate;
            //                accountDetailInfo.OrderRefundsDates = string.Join<DateTime>(";", (
            //                    from c in list
            //                    where c.OrderRefund.OrderId == orderInfo.Id
            //                    select c.OrderRefund.ManagerConfirmDate).Distinct<DateTime>());
            //                entity.AccountDetailInfo.Add(accountDetailInfo);
            //                UpateAccountType(orderInfo.Id);
            //            }
            //            foreach (OrderInfo orderInfo1 in orderInfos)
            //            {
            //                AccountDetailInfo value = new AccountDetailInfo()
            //                {
            //                    Himall_Accounts = accountInfo,
            //                    ShopId = orderInfo1.ShopId
            //                };
            //                finishDate = orderInfo1.FinishDate;
            //                value.Date = finishDate.Value;
            //                value.OrderType = AccountDetailInfo.EnumOrderType.FinishedOrder;
            //                value.OrderId = orderInfo1.Id;
            //                value.ProductActualPaidAmount = orderInfo1.ProductTotalAmount - orderInfo1.DiscountAmount;
            //                value.FreightAmount = orderInfo1.Freight;
            //                value.CommissionAmount = CalculationTotalCommission((
            //                    from c in collection
            //                    where c.Order.Id == orderInfo1.Id
            //                    select c.OrderItem).Distinct<OrderItemInfo>().ToList());
            //                value.RefundCommisAmount = new decimal(0);
            //                value.RefundTotalAmount = new decimal(0);
            //                value.OrderDate = orderInfo1.OrderDate;
            //                value.OrderRefundsDates = string.Empty;
            //                entity.AccountDetailInfo.Add(value);
            //                UpateAccountType(orderInfo1.Id);
            //            }
            //        }
            //        entity.SaveChanges();
            //        transactionScope.Complete();
            //    }
            //    catch (Exception exception1)
            //    {
            //        Exception exception = exception1;
            //        str = new string[] { "CalculationMoney :startDate=", startDate.ToString(), " endDate=", endDate.ToString(), "/r/n", exception.Message };
            //        Log.Error(string.Concat(str));
            //    }
            //}
            try
            {
                var list1 = (
                    from b in entity.ActiveMarketServiceInfo
                    join c in entity.MarketServiceRecordInfo on b.Id equals c.MarketServiceId
                    join d in nums on b.ShopId equals d
                    join aa in entity.MarketSettingInfo on b.TypeId equals aa.TypeId
                    where c.SettlementFlag == 0
                    select new { ShopId = b.ShopId, TypeId = b.TypeId, Price = ((c.EndTime.Year * 12 + c.EndTime.Month - (c.StartTime.Year * 12 + c.StartTime.Month)) * aa.Price), MSRecordId = c.Id, StartTime = c.StartTime, EndTime = c.EndTime }).ToList();
                List <AccountInfo> accountInfos = (
                    from e in entity.AccountInfo
                    where e.StartDate == startDate
                    select e).ToList();
                IEnumerable <long> nums1 = (
                    from e in list1
                    select e.ShopId).Distinct <long>();
                foreach (AccountInfo periodSettlement in accountInfos)
                {
                    var shopId =
                        from e in list1
                        where e.ShopId == periodSettlement.ShopId
                        select e;
                    foreach (var variable in shopId)
                    {
                        periodSettlement.PeriodSettlement     = periodSettlement.PeriodSettlement - variable.Price;
                        periodSettlement.AdvancePaymentAmount = periodSettlement.AdvancePaymentAmount + variable.Price;
                        DbSet <AccountMetaInfo> accountMetaInfo  = entity.AccountMetaInfo;
                        AccountMetaInfo         accountMetaInfo1 = new AccountMetaInfo()
                        {
                            AccountId        = periodSettlement.Id,
                            MetaKey          = variable.TypeId.ToDescription(),
                            MetaValue        = variable.Price.ToString("f2"),
                            ServiceStartTime = variable.StartTime,
                            ServiceEndTime   = variable.EndTime
                        };
                        accountMetaInfo.Add(accountMetaInfo1);
                    }
                }
                var collection1 = (
                    from a in entity.MarketServiceRecordInfo
                    join b in entity.ActiveMarketServiceInfo on a.MarketServiceId equals b.Id
                    join c in nums1 on b.ShopId equals c
                    where a.SettlementFlag == 0
                    select new { Shopid = b.ShopId, TypeId = b.TypeId, Msrecordid = a.Id }).ToList();
                foreach (var variable1 in collection1)
                {
                    MarketServiceRecordInfo marketServiceRecordInfo = entity.MarketServiceRecordInfo.FirstOrDefault((MarketServiceRecordInfo e) => e.Id == variable1.Msrecordid);
                    marketServiceRecordInfo.SettlementFlag = 1;
                }
                entity.SaveChanges();
            }
            catch (Exception exception3)
            {
                Exception exception2 = exception3;
                str = new string[] { "CalculationMoney 服务费:startDate=", startDate.ToString(), " endDate=", endDate.ToString(), "/r/n", exception2.Message };
                Log.Error(string.Concat(str));
            }
        }
示例#7
0
        public void OrderMarketService(int monthCount, long shopId, MarketType type)
        {
            if (shopId <= 0)
            {
                throw new HimallException("ShopId不能识别");
            }
            if (monthCount <= 0)
            {
                throw new HimallException("购买服务时长必须大于零");
            }
            var shop = DbFactory.Default.Get <ShopInfo>().Where(p => p.Id == shopId).FirstOrDefault();

            if (shop == null || shopId <= 0)
            {
                throw new HimallException("ShopId不能识别");
            }

            var price     = DbFactory.Default.Get <MarketSettingInfo>().Where(a => a.TypeId == type).Select(a => a.Price).FirstOrDefault <decimal>();
            var StartTime = DateTime.Now;
            MarketServiceRecordInfo model = new MarketServiceRecordInfo();

            model.StartTime = StartTime;
            model.Price     = price * monthCount;
            var shopAccount = DbFactory.Default.Get <ShopAccountInfo>().Where(a => a.ShopId == shopId).FirstOrDefault();//店铺帐户信息

            #region 它下面会取几次只,如为空会报异常,默认存入0的初始值
            if (shopAccount == null)
            {
                shopAccount                   = new ShopAccountInfo();
                shopAccount.ShopId            = shopId;
                shopAccount.ShopName          = shop.ShopName;
                shopAccount.Balance           = 0;
                shopAccount.PendingSettlement = 0;
                shopAccount.Settled           = 0;
                shopAccount.ReMark            = string.Empty;
                DbFactory.Default.Add(shopAccount);
            }
            #endregion

            if (shopAccount.Balance < model.Price) //店铺余额不足以支付服务费用
            {
                throw new HimallException("您的店铺余额为:" + shopAccount.Balance + "元,不足以支付此次营销服务购买费用,请先充值。");
            }

            DbFactory.Default.InTransaction(() =>
            {
                var market = DbFactory.Default.Get <ActiveMarketServiceInfo>().Where(a => a.ShopId == shopId && a.TypeId == type).FirstOrDefault();
                if (market != null)
                {
                    var maxTime = MarketApplication.GetServiceEndTime(market.Id);
                    if (maxTime > DateTime.Now) //如果结束时间大于当前时间,续费从结束时间加上购买月数,否则从当前时间加上购买月数
                    {
                        StartTime = maxTime;
                    }
                    model.StartTime = StartTime;
                    model.BuyTime   = DateTime.Now;
                    model.EndTime   = StartTime.AddMonths(monthCount);
                    // model.MarketServiceId = market.Id;
                    model.SettlementFlag  = 1;
                    model.MarketServiceId = market.Id;

                    DbFactory.Default.Add(model);
                }
                else
                {
                    model.StartTime      = StartTime;
                    model.EndTime        = StartTime.AddMonths(monthCount);
                    model.SettlementFlag = 1;
                    model.BuyTime        = DateTime.Now;

                    ActiveMarketServiceInfo activeMarketServiceInfo = new ActiveMarketServiceInfo();
                    activeMarketServiceInfo.ShopId   = shopId;
                    activeMarketServiceInfo.ShopName = shop.ShopName;
                    activeMarketServiceInfo.TypeId   = type;
                    DbFactory.Default.Add(activeMarketServiceInfo);

                    model.MarketServiceId = activeMarketServiceInfo.Id;
                    DbFactory.Default.Add(model);
                }

                var ShopAccount          = DbFactory.Default.Get <ShopAccountInfo>().Where(a => a.ShopId == shopId).FirstOrDefault();
                ShopAccountItemInfo info = new ShopAccountItemInfo();
                info.IsIncome            = false;
                info.ShopId          = shopId;
                info.DetailId        = model.Id.ToString();
                info.ShopName        = shop.ShopName;
                info.AccountNo       = shopId + info.DetailId + new Random().Next(10000);
                info.ReMark          = "店铺购买" + type.ToDescription() + "服务," + monthCount + "个月";
                info.TradeType       = ShopAccountType.MarketingServices;
                info.CreateTime      = DateTime.Now;
                info.Amount          = price * monthCount;
                info.AccoutID        = ShopAccount.Id;
                ShopAccount.Balance -= info.Amount;         //总余额减钱
                info.Balance         = ShopAccount.Balance; //变动后当前剩余金额

                DbFactory.Default.Add(info);
                DbFactory.Default.Update(ShopAccount);

                var platAccount = DbFactory.Default.Get <PlatAccountInfo>().FirstOrDefault();
                var pinfo       = new PlatAccountItemInfo
                {
                    IsIncome   = true,
                    DetailId   = model.Id.ToString(),
                    AccountNo  = info.AccountNo,
                    ReMark     = "店铺购买" + type.ToDescription() + "服务," + monthCount + "个月",
                    TradeType  = PlatAccountType.MarketingServices,
                    CreateTime = DateTime.Now,
                    Amount     = price * monthCount,
                    AccoutID   = platAccount.Id
                };
                platAccount.Balance += info.Amount;         //总余额加钱
                pinfo.Balance        = platAccount.Balance; //变动后当前剩余金额
                DbFactory.Default.Add(pinfo);
                DbFactory.Default.Update(platAccount);
            });
        }