public void ProcessRequest(HttpContext context) { string id = context.Request["id"]; if (string.IsNullOrEmpty(id)) { apiResp.msg = "ids不能为空,请检查"; apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsNotFound; bllDistributionOffLine.ContextResponse(context, apiResp); return; } BindBankCard model = bllDistributionOffLine.GetBindBankCard(int.Parse(id)); if (bllDistributionOffLine.GetCurrUserID() != model.UserId) { apiResp.code = (int)BLLJIMP.Enums.APIErrCode.InadequatePermissions; apiResp.msg = "无权操作"; bllDistributionOffLine.ContextResponse(context, apiResp); return; } if (bllDistributionOffLine.Delete(model) > 0) { apiResp.msg = "删除成功"; apiResp.status = true; } else { apiResp.msg = "删除出错"; apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail; } bllDistributionOffLine.ContextResponse(context, apiResp); }
/// <summary> /// 添加银行卡 /// </summary> /// <param name="context"></param> /// <returns></returns> private string AddBankCard(HttpContext context) { BindBankCard reqModel = bllDis.ConvertRequestToModel <BindBankCard>(new BindBankCard()); reqModel.InsertDate = DateTime.Now; reqModel.UserId = bllDis.GetCurrentUserInfo().UserID; reqModel.WebsiteOwner = bllDis.WebsiteOwner; var currentUserInfo = bllDis.GetCurrentUserInfo(); if (context.Request["ischannel"] != null && context.Request["ischannel"].ToString() == "1") { UserInfo channelUserInfo = bllUser.Get <UserInfo>(string.Format("MgrUserId='{0}'", currentUserInfo.UserID)); if (channelUserInfo != null) { reqModel.UserId = channelUserInfo.UserID; } } if (bllDis.Get <BindBankCard>(string.Format("UserId='{0}' And BankAccount='{1}' And WebsiteOwner='{2}' ", reqModel.UserId, reqModel.BankAccount, reqModel.WebsiteOwner)) != null) { resp.Msg = "银行卡号重复,请检查"; goto outoff; } if (bllDis.Add(reqModel)) { resp.Status = 1; } outoff: return(Common.JSONHelper.ObjectToJson(resp)); }
public void ProcessRequest(HttpContext context) { RequestModel requestModel = new RequestModel(); try { requestModel = ZentCloud.Common.JSONHelper.JsonToModel <RequestModel>(context.Request["data"]); } catch (Exception) { apiResp.msg = "json格式错误,请检查"; apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsNotFound; bllDistributionOffLine.ContextResponse(context, apiResp); return; } if (string.IsNullOrEmpty(requestModel.account_name)) { apiResp.msg = "开户人姓名不能为空"; apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsNotFound; bllDistributionOffLine.ContextResponse(context, apiResp); return; } if (string.IsNullOrEmpty(requestModel.bank_account)) { apiResp.msg = "银行账号不能为空"; apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsNotFound; bllDistributionOffLine.ContextResponse(context, apiResp); return; } if (string.IsNullOrEmpty(requestModel.bank_name)) { apiResp.msg = "开户人银行名称不能为空"; apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsNotFound; bllDistributionOffLine.ContextResponse(context, apiResp); return; } BindBankCard model = new BindBankCard(); model.AccountName = requestModel.account_name; model.BankAccount = requestModel.bank_account; model.BankName = requestModel.bank_name; model.AccountBranchName = requestModel.account_branch_name; model.AccountBranchProvince = requestModel.account_branch_province; model.AccountBranchCity = requestModel.account_branch_city; model.BankCode = requestModel.bank_code; model.InsertDate = DateTime.Now; model.UserId = bllDistributionOffLine.GetCurrUserID(); if (bllDistributionOffLine.Add(model)) { apiResp.msg = "添加银行卡成功"; apiResp.status = true; } else { apiResp.msg = "添加银行卡出错"; apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail; } bllDistributionOffLine.ContextResponse(context, apiResp); }
protected void Page_Load(object sender, EventArgs e) { if (!MemberCenter.checkUser(this.Context)) { return; } if (Request["id"] != null) { this.Title = "修改银行卡"; model = bll.Get <BindBankCard>(string.Format("AutoID={0} And UserId='{1}'", Request["id"], bll.GetCurrUserID())); } else { this.Title = "添加银行卡"; } }
/// <summary> /// 编辑银行卡 /// </summary> /// <param name="context"></param> /// <returns></returns> private string EditBankCard(HttpContext context) { BindBankCard reqModel = bllDis.ConvertRequestToModel <BindBankCard>(new BindBankCard()); string websiteOwner = bllDis.WebsiteOwner; BindBankCard record = bllDis.Get <BindBankCard>(string.Format("AutoID={0} And UserId='{1}' And WebsiteOwner='{2}' ", reqModel.AutoID, bllUser.GetCurrUserID(), websiteOwner)); record.BankAccount = reqModel.BankAccount; record.BankName = reqModel.BankName; record.AccountName = reqModel.AccountName; if (bllDis.Update(record)) { resp.Status = 1; } return(Common.JSONHelper.ObjectToJson(resp)); }
public void ProcessRequest(HttpContext context) { string autoId = context.Request["id"]; if (string.IsNullOrEmpty(autoId)) { apiResp.msg = "银行卡id为必填项,请检查"; apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsNotFound; bllDistributionOffLine.ContextResponse(context, apiResp); return; } BindBankCard model = bllDistributionOffLine.GetBindBankCard(int.Parse(autoId)); if (model.UserId != bllDistributionOffLine.GetCurrUserID()) { apiResp.msg = "无权操作"; apiResp.code = (int)BLLJIMP.Enums.APIErrCode.InadequatePermissions; bllDistributionOffLine.ContextResponse(context, apiResp); return; } if (model == null) { apiResp.msg = "没有找到银行卡信息"; apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsNotFound; bllDistributionOffLine.ContextResponse(context, apiResp); return; } apiResp.status = true; apiResp.result = new { id = model.AutoID, account_name = model.AccountName, bank_account = model.BankAccount, bank_name = model.BankName, account_branch_name = model.AccountBranchName, account_branch_province = model.AccountBranchProvince, account_branch_city = model.AccountBranchCity, bank_code = model.BankCode }; bllDistributionOffLine.ContextResponse(context, apiResp); }
private void GetEBPayCheck() { Guid userid; if (WebUserAuth.UserId != null) { userid = WebUserAuth.UserId.Value; } else { PrintJson("0", "您还未登录!"); return; } decimal Amount = Tool.SafeConvert.ToDecimal(Request.QueryString["Amount"], 0); WebSettingInfo rechargeSet = new TuanDai.PortalSystem.DAL.WebSettingDAL().GetWebSettingInfo("9A89CBAE-6550-4EA1-8224-EB645F38F8FA"); decimal MinRechargeAmount = decimal.Parse(rechargeSet.Param1Value); if (Amount < MinRechargeAmount) { PrintJson("0", "您好,充值金额必须大于或者等于" + MinRechargeAmount.ToString("N2") + "!"); return; } if (Amount > 5000000) { PrintJson("0", "单次充值不能超过500万!"); return; } NoHandler noHandler = new NoHandler(); string orderNo = noHandler.OnLineRechare(); if (orderNo == "0") { PrintJson("0", "您好,您的提交失败请重试!"); return; } int Sel = 11; Guid rechargeId = Guid.NewGuid(); string bankcode = ""; string userIP = Tool.WebFormHandler.GetIP(); int outStatus = 0; DynamicParameters paras = new DynamicParameters(); paras.Add("@userid", userid); paras.Add("@type", Sel); paras.Add("@amount", Amount); paras.Add("@orderNo", orderNo); paras.Add("@backcode", bankcode); paras.Add("@clientIp", userIP); paras.Add("@from", "5"); paras.Add("@outStatus", 0, DbType.Int32, ParameterDirection.Output); PublicConn.ExecuteTD(PublicConn.DBWriteType.FundWrite, "AccountRechargeInit", ref paras, CommandType.StoredProcedure); outStatus = paras.Get <int>("@outStatus"); int result = outStatus; if (result <= 0) { PrintJson("0", "您好,您的提交失败请重试!"); } UserBLL bll = new UserBLL(); UserBasicInfoInfo userInfo = bll.GetUserBasicInfoModelById(userid); //获取个人信息 if (null == userInfo) { PrintJson("0", "获取用户信息错误!"); return; } //如果查询没有身份或者真实姓名 if (string.IsNullOrEmpty(userInfo.IdentityCard) || string.IsNullOrEmpty(userInfo.RealName) || !userInfo.IsValidateIdentity) { PrintJson("0", "没有获取到用户实名信息(身份证和真实姓名)"); return; } GetBankCardNo(userInfo, userid); //是否绑定银行卡 if (string.IsNullOrEmpty(userInfo.BankAccountNo)) { PrintJson("0", "银行卡未绑定"); return; } //是否绑定手机 if (string.IsNullOrEmpty(userInfo.TelNo) || !userInfo.IsValidateMobile) { PrintJson("0", "未完成手机或实名认证"); return; } EBRechargeInfo orderInfo = new EBRechargeInfo(); orderInfo.IsBindCard = 0; orderInfo.OrderId = orderNo; //申请充值 try { var bankAccountNo = userInfo.BankAccountNo.Trim(); var identityId = userInfo.Id.ToString().Replace("-", string.Empty).ToUpper(); var bindCardModel = BindBankCardList.GetBindCardList(identityId, bankAccountNo); var rechargeAmount = (int)(Amount * 100); if (bindCardModel == null) { var model = new BindCardRequestModel { CardNo = bankAccountNo, IdCardNo = userInfo.IdentityCard, IdentityId = identityId, Phone = userInfo.TelNo, RegisterPhone = userInfo.TelNo, UserName = userInfo.RealName, }; model.RequestId = string.Concat("D", identityId); orderInfo.RequestId = model.RequestId; BindBankCard.BindCard(model); } else { orderInfo.RequestId = string.Concat("D", identityId); orderInfo.IsBindCard = 1; BankCardPay.BindPay(new BankCardPayRequestModel { Amount = rechargeAmount, CallBackUrl = EBNotifyUrl, CardLast = bindCardModel.Card_Last, CardTop = bindCardModel.Card_Top, IdentityId = identityId, OrderId = orderNo }); } } catch (Exception ex) { SysLogHelper.WriteErrorLog("易宝充值出错:GetEBPayCheck", Tool.ExceptionHelper.GetExceptionMessage(ex)); PrintJson("0", "发生错误:" + ex.Message); return; } var ResponseData = new { result = "1", msg = JsonHelper.ToJson(orderInfo) }; PrintJson(ResponseData); }
private void ConfirmPay() { Guid userid; if (WebUserAuth.UserId != null) { userid = WebUserAuth.UserId.Value; } else { PrintJson("0", "您还未登录!"); return; } string orderId = WEBRequest.GetFormString("OrderId"); string valCode = WEBRequest.GetFormString("SMSCode"); string isBindCard = WEBRequest.GetFormString("IsBindCard"); try { if (isBindCard == "1") { AccountRechareInfo ar = getAccountRechare(orderId); if (null == ar) { PrintJson("0", "充值交易未成功!"); return; } BankCardPay.ConfirmBindBankCard(orderId, valCode); } else { //获取个人信息 UserBLL userbll = new UserBLL(); UserBasicInfoInfo userInfo = userbll.GetUserBasicInfoModelById(userid); if (null == userInfo) { PrintJson("0", "获取用户信息错误!"); return; } GetBankCardNo(userInfo, userid); //是否绑定银行卡 if (string.IsNullOrEmpty(userInfo.BankAccountNo)) { PrintJson("0", "银行卡未绑定!"); return; } string requestId = WEBRequest.GetFormString("RequestId").ToUpper(); //确认绑卡 BindBankCard.ConfirmBindBankCard(requestId, valCode); //无短信充值 AccountRechareInfo ar = getAccountRechare(orderId); if (null == ar) { PrintJson("0", "充值交易未成功!"); return; } var identityId = userInfo.Id.ToString().Replace("-", string.Empty).ToUpper(); var bindCardModel = BindBankCardList.GetBindCardList(identityId, userInfo.BankAccountNo.Trim()); var rechargeAmount = (int)(ar.Amount * 100); BindBankCardPay.BindPay(new BankCardPayRequestModel { Amount = rechargeAmount, CallBackUrl = EBNotifyUrl, CardLast = bindCardModel.Card_Last, CardTop = bindCardModel.Card_Top, IdentityId = identityId, OrderId = orderId }); } } catch (Exception ex) { SysLogHelper.WriteErrorLog("易宝充值出错:ConfirmPay", Tool.ExceptionHelper.GetExceptionMessage(ex)); PrintJson("0", "发生错误:" + ex.Message); return; } PrintJson("1", ""); }