/// <summary> /// 处理余额私有方法 /// </summary> /// <param name="shopId">店铺ID</param> /// <param name="money">金额</param> /// <param name="TradeType">类别</param> /// <param name="AccountNo">交易流水号</param> /// <param name="ChargeWay">备注</param> /// <param name="AccoutID">关联资金编号</param> public void UpdateAccount(long shopId, decimal money, Himall.CommonModel.ShopAccountType TradeType, string AccountNo, string ChargeWay, long detailID = 0) { lock (obj) { //处理余额 var mShopAccountInfo = GetShopAccount(shopId); mShopAccountInfo.Balance += money; UpdateShopAccount(mShopAccountInfo); var isincome = true; if (TradeType == ShopAccountType.Refund || TradeType == ShopAccountType.MarketingServices || TradeType == ShopAccountType.WithDraw) { isincome = false; } //处理充值记录 ShopAccountItemInfo mShopAccountItemInfo = new ShopAccountItemInfo() { AccountNo = AccountNo, AccoutID = mShopAccountInfo.Id, Amount = Math.Abs(money), Balance = mShopAccountInfo.Balance, CreateTime = DateTime.Now, DetailId = detailID.ToString(), IsIncome = isincome, ReMark = ChargeWay, ShopId = shopId, ShopName = mShopAccountInfo.ShopName, TradeType = TradeType }; ///平台佣金退还 if (TradeType == ShopAccountType.PlatCommissionRefund) { var platAccount = GetPlatAccount(); platAccount.Balance -= money; UpdatePlatAccount(platAccount); PlatAccountItemInfo PlatAccountItemInfo = new PlatAccountItemInfo() { AccountNo = AccountNo, AccoutID = platAccount.Id, Amount = Math.Abs(money), Balance = platAccount.Balance, CreateTime = DateTime.Now, DetailId = detailID.ToString(), IsIncome = false, ReMark = ChargeWay, TradeType = PlatAccountType.PlatCommissionRefund }; AddPlatAccountItem(PlatAccountItemInfo); } AddShopAccountItem(mShopAccountItemInfo); } }
/// <summary> /// 资金记录添加 /// </summary> /// <param name="shopId"></param> /// <param name="money"></param> /// <param name="TradeType"></param> /// <param name="AccountNo"></param> /// <param name="ChargeWay"></param> /// <param name="detailID"></param> private static void updateAccount(long shopId, decimal money, Himall.CommonModel.ShopAccountType TradeType, string AccountNo, string ChargeWay, long detailID = 0) { lock (obj) { //处理余额 var mShopAccountInfo = _iBillingService.GetShopAccount(shopId); //处理充值记录 ShopAccountItemInfo mShopAccountItemInfo = new ShopAccountItemInfo() { AccountNo = AccountNo, AccoutID = mShopAccountInfo.Id, Amount = money, Balance = mShopAccountInfo.Balance, CreateTime = DateTime.Now, DetailId = detailID.ToString(), IsIncome = true, ReMark = ChargeWay, ShopId = shopId, ShopName = mShopAccountInfo.ShopName, TradeType = TradeType }; _iBillingService.AddShopAccountItem(mShopAccountItemInfo); } }