Beispiel #1
0
        /// <summary>
        /// 充值完成或失败,扣除冻结金额或返还冻结金额
        /// </summary>
        /// <param name="OrderId"></param>
        /// <param name="IsSuccess"></param>
        /// <returns></returns>
        public CommonActionResult EndFreezeGameRecharge(string orderId, bool isSuccess, string providerSerialNo)
        {
            var oldModel = DB.CreateQuery <C_Game_Transfer>().Where(p => p.OrderId == orderId).FirstOrDefault();

            if (oldModel == null)
            {
                throw new LogicException("发生错误,找不到相关订单");
            }
            if (oldModel.Status != (int)FillMoneyStatus.Requesting)
            {
                throw new LogicException("相关订单已被处理,无需重复操作");
            }
            DB.Begin();
            try
            {
                if (isSuccess)
                {
                    oldModel.Status           = (int)FillMoneyStatus.Success;
                    oldModel.UpdateTime       = DateTime.Now;
                    oldModel.ProviderSerialNo = providerSerialNo;
                    DB.GetDal <C_Game_Transfer>().Update(oldModel);
                    BusinessHelper.Payout_Frozen_To_End(BusinessHelper.FundCategory_GameRecharge, oldModel.UserId, orderId, string.Format("游戏充值成功,扣除冻结{1:N2}元", orderId, oldModel.RequestMoney), oldModel.RequestMoney);
                }
                else
                {
                    oldModel.Status           = (int)FillMoneyStatus.Failed;
                    oldModel.UpdateTime       = DateTime.Now;
                    oldModel.ProviderSerialNo = providerSerialNo;
                    DB.GetDal <C_Game_Transfer>().Update(oldModel);
                    BusinessHelper.Payin_FrozenBack(BusinessHelper.FundCategory_GameRecharge, oldModel.UserId, orderId, oldModel.RequestMoney, string.Format("游戏充值不成功,返还资金{0:N2}元", oldModel.RequestMoney));
                }
                DB.Commit();
            }
            catch (Exception ex)
            {
                DB.Rollback();
                throw ex;
            }
            return(new CommonActionResult()
            {
                IsSuccess = true, ReturnValue = orderId
            });
        }