/// <summary> /// 店铺提现审核 /// </summary> /// <param name="Id">审核ID</param> /// <param name="status">审核状态</param> /// <param name="Remark">平台备注</param> /// <param name="IpAddress">操作IP</param> /// <param name="UserName">操作人名称</param> /// <returns></returns> public static bool ShopApplyWithDraw(long Id, Himall.CommonModel.WithdrawStaus status, string Remark, string IpAddress = "", string UserName = "") { var model = _iBillingService.GetShopWithDrawInfo(Id); if (status == Himall.CommonModel.WithdrawStaus.Refused)//拒绝 { model.Status = status; model.PlatRemark = Remark; model.DealTime = DateTime.Now; _iBillingService.UpdateShopWithDraw(model); lock (obj) { //处理余额 var mShopAccountInfo = _iBillingService.GetShopAccount(model.ShopId); mShopAccountInfo.Balance += model.CashAmount; _iBillingService.UpdateShopAccount(mShopAccountInfo); } //操作日志 _iOperationLogService.AddPlatformOperationLog( new LogInfo { Date = DateTime.Now, Description = string.Format("店铺提现拒绝,店铺Id={0},状态为:{1}, 说明是:{2}", model.ShopId, status, Remark), IPAddress = IpAddress, PageUrl = "/Admin/ShopWithDraw/Management", UserName = UserName, ShopId = 0 }); return(true); } else if (model.CashType == Himall.CommonModel.WithdrawType.BankCard)//银行卡 { model.Status = status; model.PlatRemark = Remark; model.DealTime = DateTime.Now; _iBillingService.UpdateShopWithDraw(model); //资金处理 updateAccount(model.ShopId, model.CashAmount, Himall.CommonModel.ShopAccountType.WithDraw, DateTime.Now.ToString("yyyyMMddHHmmssffff"), "银行卡提现", Id); //操作日志 _iOperationLogService.AddPlatformOperationLog( new LogInfo { Date = DateTime.Now, Description = string.Format("店铺银行卡提现审核成功,店铺Id={0},状态为:{1}, 说明是:{2}", model.ShopId, status, Remark), IPAddress = IpAddress, PageUrl = "/Admin/ShopWithDraw/Management", UserName = UserName, ShopId = 0 }); return(true); } else { var plugins = PluginsManagement.GetPlugins <IPaymentPlugin>(true).Where(e => e.PluginInfo.PluginId.ToLower().Contains("weixin")).FirstOrDefault(); if (plugins != null) { try { var shopModel = _iShopService.GetShop(model.ShopId); EnterprisePayPara para = new EnterprisePayPara() { amount = model.CashAmount, check_name = false, openid = shopModel.WeiXinOpenId, out_trade_no = model.CashNo.ToString(), desc = "提现" }; PaymentInfo result = plugins.Biz.EnterprisePay(para); model.SerialNo = result.TradNo; model.DealTime = DateTime.Now; model.Status = WithdrawStaus.Succeed; model.PlatRemark = Remark; _iBillingService.UpdateShopWithDraw(model); //资金处理 updateAccount(model.ShopId, model.CashAmount, Himall.CommonModel.ShopAccountType.WithDraw, result.TradNo, "微信提现", Id); //操作日志 _iOperationLogService.AddPlatformOperationLog( new LogInfo { Date = DateTime.Now, Description = string.Format("店铺微信提现审核成功,店铺Id={0},状态为:{1}, 说明是:{2}", model.ShopId, status, Remark), IPAddress = IpAddress, PageUrl = "/Admin/ShopWithDraw/Management", UserName = UserName, ShopId = 0 }); return(true); } catch (Exception ex) { Log.Error("调用企业付款接口异常:" + ex.Message); model.Status = WithdrawStaus.Fail; model.PlatRemark = Remark; model.DealTime = DateTime.Now; _iBillingService.UpdateShopWithDraw(model); //操作日志 _iOperationLogService.AddPlatformOperationLog( new LogInfo { Date = DateTime.Now, Description = string.Format("店铺微信提现审核失败,店铺Id={0},状态为:{1}, 说明是:{2}", model.ShopId, status, Remark), IPAddress = IpAddress, PageUrl = "/Admin/ShopWithDraw/Management", UserName = UserName, ShopId = 0 }); return(false); } } else { return(false); } } }