public JsonResult ConfirmApply(long id, ApplyWithDrawInfo.ApplyWithDrawStatus comfirmStatus, string remark) { IMemberCapitalService memberCapitalService = this._iMemberCapitalService; ApplyWithDrawInfo.ApplyWithDrawStatus status = comfirmStatus; ApplyWithDrawInfo applyWithDrawInfo1 = memberCapitalService.GetApplyWithDrawInfo(id); if (status == ApplyWithDrawInfo.ApplyWithDrawStatus.Refuse) { memberCapitalService.RefuseApplyWithDraw(id, status, this.CurrentManager.UserName, remark); this._iOperationLogService.AddPlatformOperationLog(new LogInfo() { Date = DateTime.Now, Description = string.Format("会员提现审核拒绝,会员Id={0},状态为:{1}, 说明是:{2}", (object)applyWithDrawInfo1.MemId, (object)status, (object)remark), IPAddress = this.Request.UserHostAddress, PageUrl = "/Admin/Capital/WithDraw", UserName = this.CurrentManager.UserName, ShopId = 0L }); return(this.Json((object)new BaseController.Result() { success = true, msg = "审核成功!" })); } UserWithdrawType?applyType = applyWithDrawInfo1.ApplyType; if ((applyType.GetValueOrDefault() != UserWithdrawType.ALiPay ? 0 : (applyType.HasValue ? 1 : 0)) != 0) { if (applyWithDrawInfo1.ApplyStatus == ApplyWithDrawInfo.ApplyWithDrawStatus.PayPending) { return(this.Json((object)new BaseController.Result() { success = false, msg = "等待第三方处理中,如有误操作,请先取消后再进行付款操作!" })); } Plugin <IPaymentPlugin> plugin = Enumerable.FirstOrDefault <Plugin <IPaymentPlugin> >(PluginsManagement.GetPlugins <IPaymentPlugin>(true), (Func <Plugin <IPaymentPlugin>, bool>)(e => e.PluginInfo.PluginId == "Himall.Plugin.Payment.Alipay")); if (plugin != null) { try { string format = CurrentUrlHelper.CurrentUrlNoPort() + "/Pay/EnterpriseNotify/{0}?outid={1}"; EnterprisePayPara para = new EnterprisePayPara() { amount = applyWithDrawInfo1.ApplyAmount, check_name = false, openid = applyWithDrawInfo1.OpenId, re_user_name = applyWithDrawInfo1.NickName, out_trade_no = applyWithDrawInfo1.Id.ToString(), desc = "提现", notify_url = string.Format(format, (object)this.EncodePaymentId(plugin.PluginInfo.PluginId), (object)applyWithDrawInfo1.Id.ToString()) }; PaymentInfo paymentInfo = plugin.Biz.EnterprisePay(para); ApplyWithDrawInfo applyWithDrawInfo2 = new ApplyWithDrawInfo(); applyWithDrawInfo2.PayNo = paymentInfo.TradNo; applyWithDrawInfo2.ApplyStatus = ApplyWithDrawInfo.ApplyWithDrawStatus.PayPending; ApplyWithDrawInfo applyWithDrawInfo3 = applyWithDrawInfo2; DateTime? tradeTime = paymentInfo.TradeTime; DateTime now; if (!tradeTime.HasValue) { now = DateTime.Now; } else { tradeTime = paymentInfo.TradeTime; now = tradeTime.Value; } DateTime?nullable = new DateTime?(now); applyWithDrawInfo3.PayTime = nullable; applyWithDrawInfo2.ConfirmTime = new DateTime?(DateTime.Now); applyWithDrawInfo2.OpUser = this.CurrentManager.UserName; applyWithDrawInfo2.ApplyAmount = applyWithDrawInfo1.ApplyAmount; applyWithDrawInfo2.Id = applyWithDrawInfo1.Id; ApplyWithDrawInfo info = applyWithDrawInfo2; memberCapitalService.ConfirmApplyWithDraw(info); this._iOperationLogService.AddPlatformOperationLog(new LogInfo() { Date = DateTime.Now, Description = string.Format("会员提现审核成功,会员Id={0},状态为:{1}, 说明是:{2}", (object)applyWithDrawInfo1.MemId, (object)status, (object)remark), IPAddress = this.Request.UserHostAddress, PageUrl = "/Admin/Capital/WithDraw", UserName = this.CurrentManager.UserName, ShopId = 0L }); return(this.Json((object)new BaseController.Result() { success = true, msg = "审核操作成功", status = 2, Data = (object)paymentInfo.ResponseContentWhenFinished })); } catch (PluginException ex) { Log.Error((object)("调用企业付款接口异常:" + ex.Message)); this._iOperationLogService.AddPlatformOperationLog(new LogInfo() { Date = DateTime.Now, Description = string.Format("会员提现审核失败,会员Id={0},状态为:{1}, 说明是:{2}", (object)applyWithDrawInfo1.MemId, (object)status, (object)remark), IPAddress = this.Request.UserHostAddress, PageUrl = "/Admin/Capital/WithDraw", UserName = this.CurrentManager.UserName, ShopId = 0L }); return(this.Json((object)new BaseController.Result() { success = false, msg = ex.Message })); } catch (Exception ex) { Log.Error((object)("提现审核异常:" + ex.Message)); return(this.Json((object)new BaseController.Result() { success = false, msg = "付款接口异常" })); } } else { return(this.Json((object)new BaseController.Result() { success = false, msg = "未找到支付插件" })); } } else { Plugin <IPaymentPlugin> plugin = Enumerable.FirstOrDefault <Plugin <IPaymentPlugin> >(Enumerable.Where <Plugin <IPaymentPlugin> >(PluginsManagement.GetPlugins <IPaymentPlugin>(true), (Func <Plugin <IPaymentPlugin>, bool>)(e => e.PluginInfo.PluginId.ToLower().Contains("weixin")))); if (plugin != null) { try { EnterprisePayPara para = new EnterprisePayPara() { amount = applyWithDrawInfo1.ApplyAmount, check_name = false, openid = applyWithDrawInfo1.OpenId, out_trade_no = applyWithDrawInfo1.Id.ToString(), desc = "提现" }; PaymentInfo paymentInfo = plugin.Biz.EnterprisePay(para); ApplyWithDrawInfo applyWithDrawInfo2 = new ApplyWithDrawInfo(); applyWithDrawInfo2.PayNo = paymentInfo.TradNo; applyWithDrawInfo2.ApplyStatus = ApplyWithDrawInfo.ApplyWithDrawStatus.WithDrawSuccess; applyWithDrawInfo2.Remark = plugin.PluginInfo.Description; ApplyWithDrawInfo applyWithDrawInfo3 = applyWithDrawInfo2; DateTime? tradeTime = paymentInfo.TradeTime; DateTime now; if (!tradeTime.HasValue) { now = DateTime.Now; } else { tradeTime = paymentInfo.TradeTime; now = tradeTime.Value; } DateTime?nullable = new DateTime?(now); applyWithDrawInfo3.PayTime = nullable; applyWithDrawInfo2.ConfirmTime = new DateTime?(DateTime.Now); applyWithDrawInfo2.OpUser = this.CurrentManager.UserName; applyWithDrawInfo2.ApplyAmount = applyWithDrawInfo1.ApplyAmount; applyWithDrawInfo2.Id = applyWithDrawInfo1.Id; ApplyWithDrawInfo info = applyWithDrawInfo2; memberCapitalService.ConfirmApplyWithDraw(info); this._iOperationLogService.AddPlatformOperationLog(new LogInfo() { Date = DateTime.Now, Description = string.Format("会员提现审核成功,会员Id={0},状态为:{1}, 说明是:{2}", (object)applyWithDrawInfo1.MemId, (object)status, (object)remark), IPAddress = this.Request.UserHostAddress, PageUrl = "/Admin/Capital/WithDraw", UserName = this.CurrentManager.UserName, ShopId = 0L }); } catch (PluginException ex) { Log.Error((object)("调用企业付款接口异常:" + ex.Message)); this._iOperationLogService.AddPlatformOperationLog(new LogInfo() { Date = DateTime.Now, Description = string.Format("会员提现审核失败,会员Id={0},状态为:{1}, 说明是:{2}", (object)applyWithDrawInfo1.MemId, (object)status, (object)remark), IPAddress = this.Request.UserHostAddress, PageUrl = "/Admin/Capital/WithDraw", UserName = this.CurrentManager.UserName, ShopId = 0L }); return(this.Json((object)new BaseController.Result() { success = false, msg = ex.Message })); } catch (Exception ex) { Log.Error((object)("提现审核异常:" + ex.Message)); ApplyWithDrawInfo info = new ApplyWithDrawInfo() { ApplyStatus = ApplyWithDrawInfo.ApplyWithDrawStatus.PayFail, Remark = plugin.PluginInfo.Description, ConfirmTime = new DateTime?(DateTime.Now), OpUser = this.CurrentManager.UserName, ApplyAmount = applyWithDrawInfo1.ApplyAmount, Id = applyWithDrawInfo1.Id }; memberCapitalService.ConfirmApplyWithDraw(info); this._iOperationLogService.AddPlatformOperationLog(new LogInfo() { Date = DateTime.Now, Description = string.Format("会员提现审核失败,会员Id={0},状态为:{1}, 说明是:{2}", (object)applyWithDrawInfo1.MemId, (object)status, (object)remark), IPAddress = this.Request.UserHostAddress, PageUrl = "/Admin/Capital/WithDraw", UserName = this.CurrentManager.UserName, ShopId = 0L }); return(this.Json((object)new BaseController.Result() { success = false, msg = "付款接口异常" })); } return(this.Json((object)new BaseController.Result() { success = true, msg = "审核操作成功" })); } return(this.Json((object)new BaseController.Result() { success = false, msg = "未找到支付插件" })); } }