/// <summary> /// 获取统计数据 /// </summary> private void GetStatistics() { WebSiteDataInfo websitedatemodel = new WebSiteDataBLL().GetWebSiteData(); if (websitedatemodel != null) { this.UserCount = websitedatemodel.TotalUser.ToString(); this.UserName = Tool.CookieHelper.GetCookie("TDWUserName"); TuanDai.PortalSystem.BLL.UserBLL userBll = new TuanDai.PortalSystem.BLL.UserBLL(); userBasicObj = userBll.GetUserBasicInfoModelById(WebUserAuth.UserId.Value); if (this.UserName.IsEmpty()) { if (userBasicObj != null) { this.UserName = userBasicObj.UserName; } } this.returnUrl = Tool.WEBRequest.GetString("ReturnUrl"); if (!string.IsNullOrEmpty(returnUrl) && returnUrl.ToLower().Contains(TuanDai.WXApiWeb.GlobalUtils.ActivityWebsiteUrl.ToLower()))//跳转回ReturnUrl { try { Response.Redirect(returnUrl, false); } catch (Exception ex) { SysLogHelper.WriteErrorLog("注册成功页面跳转异常", Tool.ExceptionHelper.GetExceptionMessage(ex)); } finally { Response.End(); } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //判断openid为空时,重新授权 if (GlobalUtils.IsWeiXinBrowser) { Guid?userId = WebUserAuth.UserId; if (userId == null || userId == Guid.Empty) { PrintJson("-1", "对不起,您还未登录!"); return; } TuanDai.PortalSystem.BLL.UserBLL bll = new TuanDai.PortalSystem.BLL.UserBLL(); userModel = bll.GetUserBasicInfoModelById(userId.Value); if (GlobalUtils.OpenId.IsEmpty()) { string strOpenId = TuanDai.WXApiWeb.Common.WeiXinApi.GetUserWXOpenId(userModel.Id); if (strOpenId.IsNotEmpty()) { GlobalUtils.WriteOpenIdToCookie(strOpenId.ToText()); } else { TuanDai.WXApiWeb.Common.WeiXinApi wxApi = new Common.WeiXinApi(); wxApi.GetOpenidAndAccessToken(this); } } } GetWXJsApiParam(); } }
/// <summary> /// We计划分期宝取消赎回 /// </summary> public void CancleWeFqbTransfer() { Guid userid = WebUserAuth.UserId.Value; if (userid == Guid.Empty) { PrintJson("-99", "登陆超时"); } TuanDai.PortalSystem.BLL.UserBLL userbll = new TuanDai.PortalSystem.BLL.UserBLL(); TuanDai.PortalSystem.Model.UserBasicInfoInfo model = userbll.GetUserBasicInfoModelById(userid); if (model == null) { PrintJson("-98", "用户不存在"); } Guid weOrderId = WEBRequest.GetFormGuid("WeOrderId"); if (weOrderId == Guid.Empty) { PrintJson("-9", "We订单不存在"); } int status = 0; TuanDai.PortalSystem.BLL.WeOrderBLL webll = new TuanDai.PortalSystem.BLL.WeOrderBLL(); webll.RevokeWeFqbRansom(weOrderId, out status); if (status == 1) { PrintJson("1", "撤销转让成功"); } else { string errMsg = ""; switch (status) { case 0: errMsg = "系统异常"; break; case 2: errMsg = "不在赎回状态"; break; case 3: errMsg = "不是We计划分期宝"; break; case 4: errMsg = "债权已有人承接,不能撤销"; break; } PrintJson("0", errMsg); } }
protected void LoadData() { Guid userId = WebUserAuth.UserId.Value; if (Request.QueryString["uid"] != null) { userId = Guid.Parse(Request.QueryString["uid"]); } TuanDai.PortalSystem.BLL.UserBLL bll = new TuanDai.PortalSystem.BLL.UserBLL(); userModel = bll.GetUserBasicInfoModelById(userId); if (userModel == null) { Response.Redirect("//passport.tuandai.com/2login?ret=" + HttpUtility.UrlEncode(HttpContext.Current.Request.RawUrl)); return; } userRegDate = userModel.AddDate.Value; GetProfitStatistics(userId); GetAccountInfo(userId); DqFundModel = GetDQFundModel(userId); ZxFundModel = new TuanDai.ZXSystem.BLL.FundStatisticsBLL().GetFundStatisticsInfoByUserId(userId); if (ZxFundModel == null) { ZxFundModel = new FundStatisticsInfo(); } GetZxFundModelFromDQ(userId); if (DqFundModel == null) { DqFundModel = new WXFundStatistModel(); } if (DqFundModel.DueComeInterest >= decimal.Parse("-0.03") && DqFundModel.DueComeInterest < 0) { DqFundModel.DueComeInterest = 0; } JoinTDDay = Tool.DateHelper.GetDateDiffDay(DateTime.Parse(userModel.AddDate.Value.ToString("yyyy-MM-dd")), DateTime.Today.AddDays(1)); if (JoinTDDay <= 0) { JoinTDDay = 1; } totalPayAmount = (fundAccountInfo.NetPayOutInterest ?? 0) + (fundAccountInfo.TotalPayOutMember ?? 0) + (fundAccountInfo.TotalWithdrawDepositHandRecharge ?? 0) + (fundAccountInfo.TotalInvestCommission ?? 0) + (fundAccountInfo.BorrowCommission ?? 0) + (fundAccountInfo.DuePayOutInterest ?? 0); //GetTotalWithDrawal(); TotalWithDrawal = fundAccountInfo.TotalWithdrawDeposit ?? 0; }
public void GetWXJsApiParam() { string strOpenId = GlobalUtils.OpenId; if (strOpenId.IsEmpty()) { PrintJson("-1", "微信未授权,取不到OpenId值"); return; } Guid?userId = WebUserAuth.UserId; if (userId == null || userId == Guid.Empty) { PrintJson("-1", "对不起,您还未登录!"); return; } TuanDai.PortalSystem.BLL.UserBLL bll = new TuanDai.PortalSystem.BLL.UserBLL(); UserBasicInfoInfo userModel = bll.GetUserBasicInfoModelById(userId.Value); if (userModel == null) { PrintJson("-1", "对不起,该用户不存在!"); return; } decimal Amount = Tool.SafeConvert.ToDecimal(WEBRequest.GetFormString("Amount"), 0); decimal tmpAmount = Math.Floor(Amount * 100) / 100; if (tmpAmount != Amount) { PrintJson("-1", "充值金额最多只能2位小数,如106.32!"); return; } WebSettingInfo rechargeSet = new TuanDai.PortalSystem.DAL.WebSettingDAL().GetWebSettingInfo("9A89CBAE-6550-4EA1-8224-EB645F38F8FA"); decimal MinRechargeAmount = decimal.Parse(rechargeSet.Param1Value); if (Amount < MinRechargeAmount) { PrintJson("-1", "最低充值金额为" + MinRechargeAmount.ToString("N2") + "元!"); return; } if (Amount > 500000) { PrintJson("-1", "单次充值不能超过50万!"); return; } NoHandler noHandler = new NoHandler(); string orderNo = noHandler.OnLineRechare(); if (orderNo == "0") { PrintJson("-1", "您好,您的提交失败请重试!"); return; } int Sel = 9; //标记是微信支付 Guid rechargeId = Guid.NewGuid(); int outStatus = 0; string bankcode = ""; string userIP = Tool.WebFormHandler.GetIP(); //using (SqlConnection connection = TuanDai.PortalSystem.DAL.PubConstant.CrateConnection()) //{ var paramData = new Dapper.DynamicParameters(); paramData.Add("@userid", userId); paramData.Add("@type", Sel); paramData.Add("@amount", Amount); paramData.Add("@orderNo", orderNo); paramData.Add("@backcode", bankcode); paramData.Add("@clientIp", userIP); paramData.Add("@from", "5"); paramData.Add("@outStatus", 0, System.Data.DbType.Int32, System.Data.ParameterDirection.Output); TuanDai.DB.TuanDaiDB.Execute(TdConfig.DBFundWrite, "AccountRechargeInit", ref paramData, CommandType.StoredProcedure); outStatus = paramData.Get <int>("@outStatus"); // connection.Execute("AccountRechargeInit", paramData, null, null, System.Data.CommandType.StoredProcedure); // outStatus = paramData.Get<int>("@outStatus"); // connection.Close(); // connection.Dispose(); //} int result = outStatus; if (result > 0) { TuanDai.Payment.PaymentBLL jsApiPay = new TuanDai.Payment.PaymentBLL("JSAPI", strOpenId, orderNo, userModel.RealName, userModel.IdentityCard); TuanDai.Payment.WxPayData unifiedOrderResult = null; try { int PayAmount = int.Parse(double.Parse((Amount * 100).ToString()).ToString()); unifiedOrderResult = jsApiPay.WXJsApiUnifiedOrder(PayAmount.ToString()); } catch (Exception ex) { PrintJson("-1", ex.Message); return; } string wxJsApiParam = jsApiPay.GetJsApiParameters();//获取H5调起JS API参数 var jsonData = new { result = "1", msg = wxJsApiParam }; PrintJson(jsonData); } else { PrintJson("-1", "您好,您的提交失败请重试!"); return; } }
public void ApplyFTBTransfer() { Guid userid = WebUserAuth.UserId.Value; if (userid == Guid.Empty) { PrintJson("-99", "登陆超时"); } TuanDai.PortalSystem.BLL.UserBLL userbll = new TuanDai.PortalSystem.BLL.UserBLL(); TuanDai.PortalSystem.Model.UserBasicInfoInfo model = userbll.GetUserBasicInfoModelById(userid); if (model == null) { PrintJson("-98", "用户不存在"); } if ((model.uStatus ?? 0) != 1) { PrintJson("-10", "用户已被冻结"); } Guid weOrderId = WEBRequest.GetFormGuid("WeOrderId"); if (weOrderId == Guid.Empty) { PrintJson("-9", "We订单不存在"); } decimal applyAmount = WEBRequest.GetFormString("ApplyAmount").ToDecimal(0); if (applyAmount <= 0) { PrintJson("-1", "申请的退出本金必须大于0"); } if (applyAmount % 1 != 0) { PrintJson("-1", "请输入大于0的整数金额"); } if (GlobalUtils.IsOpenCGT) { var reqMode = new CgtCallbackUrl.Model.ModelRequest.ApplyFTBTransferRequest { WeOrderId = weOrderId, TransferAmount = applyAmount }; string url = CgtCallBackConfig.GetCgtTradePwdUrl(reqMode, CgtCallBackConfig.CgtCallBackType.FTBPreExit); PrintJson("8888", url); } else { //验证交易密码 var bll = new UserSettingBLL(); var usersetting = bll.GetUserSettingInfo(userid); if (usersetting != null) { #region if (usersetting.PayPwdErrorDate.HasValue) { DateTime date1 = Convert.ToDateTime(usersetting.PayPwdErrorDate.Value.ToString("yyyy/MM/dd")); DateTime date2 = Convert.ToDateTime(DateTime.Now.ToString("yyyy/MM/dd")); if (date1 == date2 && usersetting.PayPwdErrorCount >= 5) { PrintJson("-151", "交易密码已错误5次,请24小时后再进行此操作"); } if (date1 != date2 && usersetting.PayPwdErrorCount > 1) { usersetting.PayPwdErrorCount = 0; usersetting.PayPwdErrorDate = null; } } string PayPwd = Tool.Encryption.MD5(Context.Request["TranPwd"]); if (PayPwd != model.PayPwd) { //记录登录错误次数 if (usersetting.PayPwdErrorCount == null) { usersetting.PayPwdErrorCount = 0; } usersetting.PayPwdErrorCount += 1; usersetting.PayPwdErrorDate = DateTime.Now; //db.SaveChanges(); bll.UpdateUserSettingInfo(usersetting); if (usersetting.PayPwdErrorCount == 5) { PrintJson("-151", "交易密码已错误5次,请24小时后再进行此操作"); } else { PrintJson("-15", "交易密码错误,您还剩下" + (5 - usersetting.PayPwdErrorCount).ToString() + "次机会"); } } else { //清除错误记录 usersetting.PayPwdErrorCount = 0; usersetting.PayPwdErrorDate = null; bll.UpdateUserSettingInfo(usersetting); } #endregion } int status = 0; string strError = ""; TuanDai.PortalSystem.BLL.WeFTBBLL webll = new TuanDai.PortalSystem.BLL.WeFTBBLL(); webll.ApplyFTBRansom(weOrderId, applyAmount, out status, out strError); PrintJson(status.ToString(), strError); } }
/// <summary> /// We计划分期宝申请赎回 /// </summary> public void ApplyWeFqbTransfer() { Guid userid = WebUserAuth.UserId.Value; if (userid == Guid.Empty) { PrintJson("-99", "登陆超时"); } TuanDai.PortalSystem.BLL.UserBLL userbll = new TuanDai.PortalSystem.BLL.UserBLL(); TuanDai.PortalSystem.Model.UserBasicInfoInfo model = userbll.GetUserBasicInfoModelById(userid); if (model == null) { PrintJson("-98", "用户不存在"); } if ((model.uStatus ?? 0) != 1) { PrintJson("-10", "用户已被冻结"); } Guid weOrderId = WEBRequest.GetFormGuid("WeOrderId"); if (weOrderId == Guid.Empty) { PrintJson("-9", "We订单不存在"); } if (GlobalUtils.IsOpenCGT) { var reqMode = new CgtCallbackUrl.Model.ModelRequest.ApplyWeFQBTransferRequest { WeOrderId = weOrderId }; string url = CgtCallBackConfig.GetCgtTradePwdUrl(reqMode, CgtCallBackConfig.CgtCallBackType.WeFqbPreExit); PrintJson("8888", url); } else { //验证交易密码 var bll = new UserSettingBLL(); var usersetting = bll.GetUserSettingInfo(userid); if (usersetting != null) { if (usersetting.PayPwdErrorDate.HasValue) { DateTime date1 = Convert.ToDateTime(usersetting.PayPwdErrorDate.Value.ToString("yyyy/MM/dd")); DateTime date2 = Convert.ToDateTime(DateTime.Now.ToString("yyyy/MM/dd")); if (date1 == date2 && usersetting.PayPwdErrorCount >= 5) { PrintJson("-151", "交易密码已错误5次,请24小时后再进行此操作"); } if (date1 != date2 && usersetting.PayPwdErrorCount > 1) { usersetting.PayPwdErrorCount = 0; usersetting.PayPwdErrorDate = null; } } string PayPwd = Tool.Encryption.MD5(Context.Request["TranPwd"]); if (PayPwd != model.PayPwd) { //记录登录错误次数 if (usersetting.PayPwdErrorCount == null) { usersetting.PayPwdErrorCount = 0; } usersetting.PayPwdErrorCount += 1; usersetting.PayPwdErrorDate = DateTime.Now; //db.SaveChanges(); bll.UpdateUserSettingInfo(usersetting); if (usersetting.PayPwdErrorCount == 5) { PrintJson("-151", "交易密码已错误5次,请24小时后再进行此操作"); } else { PrintJson("-15", "交易密码错误,您还剩下" + (5 - usersetting.PayPwdErrorCount).ToString() + "次机会"); } } else { //清除错误记录 usersetting.PayPwdErrorCount = 0; usersetting.PayPwdErrorDate = null; //db.SaveChanges(); bll.UpdateUserSettingInfo(usersetting); } } int status = 0; TuanDai.PortalSystem.BLL.WeOrderBLL webll = new TuanDai.PortalSystem.BLL.WeOrderBLL(); webll.ApplyWeFqbRansom(weOrderId, out status); if (status == 1) { PrintJson("1", "申请转让成功"); } else { string errMsg = ""; switch (status) { case 0: errMsg = "系统异常"; break; case 2: errMsg = "不是We计划分期宝"; break; case 3: errMsg = "回款中状态不允许赎回"; break; case 4: errMsg = "持有时间必须超过3个月"; break; case 5: errMsg = "只有投标中的We计划才能转让"; break; } PrintJson("0", errMsg); } } }