public JsonResult ApplyWithDrawList(ApplyWithDrawInfo.ApplyWithDrawStatus capitalType, string withdrawno, string user, int page, int rows) { IMemberCapitalService memberCapitalService = ServiceHelper.Create <IMemberCapitalService>(); IMemberService memberService = ServiceHelper.Create <IMemberService>(); long?nullable = null; if (!string.IsNullOrWhiteSpace(user)) { nullable = new long?((memberService.GetMemberByName(user) ?? new UserMemberInfo() { Id = 0 }).Id); } ApplyWithDrawQuery applyWithDrawQuery = new ApplyWithDrawQuery() { memberId = nullable, PageSize = rows, PageNo = page, withDrawStatus = new ApplyWithDrawInfo.ApplyWithDrawStatus?(capitalType) }; ApplyWithDrawQuery nullable1 = applyWithDrawQuery; if (!string.IsNullOrWhiteSpace(withdrawno)) { nullable1.withDrawNo = new long?(long.Parse(withdrawno)); } PageModel <ApplyWithDrawInfo> applyWithDraw = memberCapitalService.GetApplyWithDraw(nullable1); IEnumerable <ApplyWithDrawModel> applyWithDrawModels = applyWithDraw.Models.ToList().Select <ApplyWithDrawInfo, ApplyWithDrawModel>((ApplyWithDrawInfo e) => { string description = e.ApplyStatus.ToDescription(); UserMemberInfo member = memberService.GetMember(e.MemId); return(new ApplyWithDrawModel() { Id = e.Id, ApplyAmount = e.ApplyAmount, ApplyStatus = e.ApplyStatus, ApplyStatusDesc = description, ApplyTime = e.ApplyTime.ToString(), NickName = e.NickName, MemberName = member.UserName, ConfirmTime = e.ConfirmTime.ToString(), MemId = e.MemId, OpUser = e.OpUser, PayNo = e.PayNo, PayTime = e.PayTime.ToString(), Remark = e.Remark }); }); DataGridModel <ApplyWithDrawModel> dataGridModel = new DataGridModel <ApplyWithDrawModel>() { rows = applyWithDrawModels, total = applyWithDraw.Total }; return(Json(dataGridModel)); }
public void RefuseApplyWithDraw(long id, ApplyWithDrawInfo.ApplyWithDrawStatus status, string opuser, string remark) { var model = Context.ApplyWithDrawInfo.FirstOrDefault(e => e.Id == id); model.ApplyStatus = status; model.OpUser = opuser; model.Remark = remark; model.ConfirmTime = DateTime.Now; var capital = Context.CapitalInfo.FirstOrDefault(e => e.MemId == model.MemId); capital.Balance = capital.Balance.Value + model.ApplyAmount; capital.FreezeAmount = capital.FreezeAmount - model.ApplyAmount; Context.SaveChanges(); }
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 = "未找到支付插件" })); } }
public JsonResult ApplyWithDrawList(ApplyWithDrawInfo.ApplyWithDrawStatus capitalType, UserWithdrawType?applyType, string withdrawno, string user, int page, int rows) { IMemberCapitalService memberCapitalService = this._iMemberCapitalService; IMemberService memberService = this._iMemberService; long?nullable = new long?(); if (!string.IsNullOrWhiteSpace(user)) { UserMemberInfo userMemberInfo = memberService.GetMemberByName(user); if (userMemberInfo == null) { userMemberInfo = new UserMemberInfo() { Id = 0L } } ; nullable = new long?(userMemberInfo.Id); } ApplyWithDrawQuery applyWithDrawQuery = new ApplyWithDrawQuery(); applyWithDrawQuery.memberId = nullable; applyWithDrawQuery.ApplyType = applyType; applyWithDrawQuery.PageSize = rows; applyWithDrawQuery.PageNo = page; applyWithDrawQuery.withDrawStatus = new ApplyWithDrawInfo.ApplyWithDrawStatus?(capitalType); ApplyWithDrawQuery query = applyWithDrawQuery; if (!string.IsNullOrWhiteSpace(withdrawno)) { query.withDrawNo = new long?(long.Parse(withdrawno)); } ObsoletePageModel <ApplyWithDrawInfo> applyWithDraw = memberCapitalService.GetApplyWithDraw(query); IEnumerable <ApplyWithDrawModel> enumerable = Enumerable.Select <ApplyWithDrawInfo, ApplyWithDrawModel>((IEnumerable <ApplyWithDrawInfo>)Enumerable.ToList <ApplyWithDrawInfo>((IEnumerable <ApplyWithDrawInfo>)applyWithDraw.Models), (Func <ApplyWithDrawInfo, ApplyWithDrawModel>)(e => { string str = EnumHelper.ToDescription((Enum)e.ApplyStatus); UserMemberInfo member = memberService.GetMember(e.MemId); return(new ApplyWithDrawModel() { Id = e.Id, ApplyAmount = e.ApplyAmount, ApplyStatus = e.ApplyStatus, ApplyStatusDesc = str, ApplyTime = e.ApplyTime.ToString(), NickName = e.NickName, MemberName = member.UserName, ConfirmTime = e.ConfirmTime.ToString(), MemId = e.MemId, OpUser = e.OpUser, PayNo = e.PayNo, PayTime = e.PayTime.ToString(), Remark = e.Remark }); })); return(this.Json((object)new DataGridModel <ApplyWithDrawModel>() { rows = enumerable, total = applyWithDraw.Total })); }
/// <summary> /// 拒绝会员提现申请 /// </summary> /// <param name="id"></param> /// <param name="status"></param> /// <param name="opuser"></param> /// <param name="remark"></param> public static void RefuseApplyWithDraw(long id, ApplyWithDrawInfo.ApplyWithDrawStatus status, string opuser, string remark) { _iMemberCapitalService.RefuseApplyWithDraw(id, status, opuser, remark); }
public JsonResult ConfirmPay(long id, ApplyWithDrawInfo.ApplyWithDrawStatus status, string remark) { JsonResult jsonResult; IMemberCapitalService memberCapitalService = ServiceHelper.Create <IMemberCapitalService>(); if (status == ApplyWithDrawInfo.ApplyWithDrawStatus.Refuse) { memberCapitalService.RefuseApplyWithDraw(id, status, base.CurrentManager.UserName, remark); return(Json(new { success = true, msg = "审核成功!" })); } ApplyWithDrawQuery applyWithDrawQuery = new ApplyWithDrawQuery() { withDrawNo = new long?(id), PageNo = 1, PageSize = 1 }; ApplyWithDrawQuery applyWithDrawQuery1 = applyWithDrawQuery; ApplyWithDrawInfo applyWithDrawInfo = memberCapitalService.GetApplyWithDraw(applyWithDrawQuery1).Models.FirstOrDefault(); Plugin <IPaymentPlugin> plugin = ( from e in PluginsManagement.GetPlugins <IPaymentPlugin>(true) where e.PluginInfo.PluginId.ToLower().Contains("weixin") select e).FirstOrDefault <Plugin <IPaymentPlugin> >(); if (plugin == null) { return(Json(new { success = false, msg = "未找到支付插件" })); } try { EnterprisePayPara enterprisePayPara = new EnterprisePayPara() { amount = applyWithDrawInfo.ApplyAmount, check_name = false, openid = applyWithDrawInfo.OpenId, out_trade_no = applyWithDrawInfo.Id.ToString(), desc = "提现" }; PaymentInfo paymentInfo = plugin.Biz.EnterprisePay(enterprisePayPara); ApplyWithDrawInfo applyWithDrawInfo1 = new ApplyWithDrawInfo() { PayNo = paymentInfo.TradNo, ApplyStatus = ApplyWithDrawInfo.ApplyWithDrawStatus.WithDrawSuccess, Remark = plugin.PluginInfo.Description, PayTime = new DateTime?((paymentInfo.TradeTime.HasValue ? paymentInfo.TradeTime.Value : DateTime.Now)), ConfirmTime = new DateTime?(DateTime.Now), OpUser = base.CurrentManager.UserName, ApplyAmount = applyWithDrawInfo.ApplyAmount, Id = applyWithDrawInfo.Id }; memberCapitalService.ConfirmApplyWithDraw(applyWithDrawInfo1); return(Json(new { success = true, msg = "付款成功" })); } catch (Exception exception) { Log.Error(string.Concat("调用企业付款接口异常:", exception.Message)); ApplyWithDrawInfo applyWithDrawInfo2 = new ApplyWithDrawInfo() { ApplyStatus = ApplyWithDrawInfo.ApplyWithDrawStatus.PayFail, Remark = plugin.PluginInfo.Description, ConfirmTime = new DateTime?(DateTime.Now), OpUser = base.CurrentManager.UserName, ApplyAmount = applyWithDrawInfo.ApplyAmount, Id = applyWithDrawInfo.Id }; memberCapitalService.ConfirmApplyWithDraw(applyWithDrawInfo2); jsonResult = Json(new { success = false, msg = "付款接口异常" }); } return(jsonResult); }
public JsonResult ConfirmApply(long id, ApplyWithDrawInfo.ApplyWithDrawStatus comfirmStatus, string remark) { var service = _iMemberCapitalService; ApplyWithDrawQuery query = new ApplyWithDrawQuery { withDrawNo = id, PageNo = 1, PageSize = 1 }; var status = comfirmStatus; var model = service.GetApplyWithDraw(query).Models.FirstOrDefault(); if (status == ApplyWithDrawInfo.ApplyWithDrawStatus.Refuse) { service.RefuseApplyWithDraw(id, status, CurrentManager.UserName, remark); //操作日志 _iOperationLogService.AddPlatformOperationLog( new LogInfo { Date = DateTime.Now, Description = string.Format("会员提现审核拒绝,会员Id={0},状态为:{1}, 说明是:{2}", model.MemId, status, remark), IPAddress = Request.UserHostAddress, PageUrl = "/Admin/Capital/WithDraw", UserName = CurrentManager.UserName, ShopId = 0 }); return(Json(new { success = true, msg = "审核成功!" })); } else { var plugins = PluginsManagement.GetPlugins <IPaymentPlugin>(true).Where(e => e.PluginInfo.PluginId.ToLower().Contains("weixin")).FirstOrDefault(); if (plugins != null) { try { EnterprisePayPara para = new EnterprisePayPara() { amount = model.ApplyAmount, check_name = false, openid = model.OpenId, out_trade_no = model.Id.ToString(), desc = "提现" }; PaymentInfo result = plugins.Biz.EnterprisePay(para); ApplyWithDrawInfo info = new ApplyWithDrawInfo { PayNo = result.TradNo, ApplyStatus = ApplyWithDrawInfo.ApplyWithDrawStatus.WithDrawSuccess, Remark = plugins.PluginInfo.Description, PayTime = result.TradeTime.HasValue ? result.TradeTime.Value : DateTime.Now, ConfirmTime = DateTime.Now, OpUser = CurrentManager.UserName, ApplyAmount = model.ApplyAmount, Id = model.Id }; //Log.Debug("提现:" + info.PayNo); service.ConfirmApplyWithDraw(info); //操作日志 _iOperationLogService.AddPlatformOperationLog( new LogInfo { Date = DateTime.Now, Description = string.Format("会员提现审核成功,会员Id={0},状态为:{1}, 说明是:{2}", model.MemId, status, remark), IPAddress = Request.UserHostAddress, PageUrl = "/Admin/Capital/WithDraw", UserName = CurrentManager.UserName, ShopId = 0 }); } catch (PluginException pex) {//插件异常,直接返回错误信息 Log.Error("调用企业付款接口异常:" + pex.Message); //操作日志 _iOperationLogService.AddPlatformOperationLog( new LogInfo { Date = DateTime.Now, Description = string.Format("会员提现审核失败,会员Id={0},状态为:{1}, 说明是:{2}", model.MemId, status, remark), IPAddress = Request.UserHostAddress, PageUrl = "/Admin/Capital/WithDraw", UserName = CurrentManager.UserName, ShopId = 0 }); return(Json(new { success = false, msg = pex.Message })); } catch (Exception ex) { Log.Error("提现审核异常:" + ex.Message); ApplyWithDrawInfo info = new ApplyWithDrawInfo { ApplyStatus = ApplyWithDrawInfo.ApplyWithDrawStatus.PayFail, Remark = plugins.PluginInfo.Description, ConfirmTime = DateTime.Now, OpUser = CurrentManager.UserName, ApplyAmount = model.ApplyAmount, Id = model.Id }; service.ConfirmApplyWithDraw(info); //操作日志 _iOperationLogService.AddPlatformOperationLog( new LogInfo { Date = DateTime.Now, Description = string.Format("会员提现审核失败,会员Id={0},状态为:{1}, 说明是:{2}", model.MemId, status, remark), IPAddress = Request.UserHostAddress, PageUrl = "/Admin/Capital/WithDraw", UserName = CurrentManager.UserName, ShopId = 0 }); return(Json(new { success = false, msg = "付款接口异常" })); } } else { return(Json(new { success = false, msg = "未找到支付插件" })); } } return(Json(new { success = true, msg = "付款成功" })); }