Пример #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string cookieUrl = Tool.CookieHelper.GetCookie("InvestUrl").ToText();

        if (cookieUrl.Trim().IsNotEmpty())
        {
            GoReturnUrl = cookieUrl;
            Tool.CookieHelper.ClearCookie("InvestUrl");
        }
        if (!IsPostBack)
        {
            if (TuanDai.WXApiWeb.WebUserAuth.IsAuthenticated)
            {
                Guid              userid   = TuanDai.WXApiWeb.WebUserAuth.UserId.Value;
                string            strSQL   = "select count(1) from AccountRechare with(nolock) where UserId=@userId and Status=2 and [type] in( 2, 3, 4, 6, 8, 12 )";
                DynamicParameters dyParams = new DynamicParameters();
                dyParams.Add("@userId", userid);
                int iCount = PublicConn.QuerySingleWrite <int>(strSQL, ref dyParams);
                if (iCount > 0)
                {
                    TuanDai.PortalSystem.BLL.VipGetWorthBLL.AddGetWorth(userid, (int)ConstString.UserGrowthType.FirstReCharge, null, 0);
                }
            }
        }
    }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            userId = WebUserAuth.UserId.Value;
            if (!IsPostBack)
            {
                UserBLL userBll = new UserBLL();
                userModel = userBll.GetUserBasicInfoModelById(userId);

                DrawType = WEBRequest.GetQueryInt("drawtype", 2);
                if (DrawType != 1 && DrawType != 2)
                {
                    DrawType = 2;
                }
                string            strSQL   = "select Id, ActualWithdrawDeposit, merchanType from AppWithdrewFund where UserId=@userId  order by AppDate desc";
                DynamicParameters dyParams = new DynamicParameters();
                dyParams.Add("@userId", userId);

                WXAppWithdrewFund appWith = PublicConn.QuerySingleWrite <WXAppWithdrewFund>(strSQL, ref dyParams);
                if (appWith != null)
                {
                    Amout = appWith.ActualWithdrawDeposit ?? 0;
                    if (DrawType == 1)
                    {
                        strSQL   = " update AppWithdrewFund set merchanType=9 where Id=@id";
                        dyParams = new DynamicParameters();
                        dyParams.Add("@id", appWith.Id);
                        PublicConn.ExecuteTD(PublicConn.DBWriteType.FundWrite, strSQL, ref dyParams);
                    }
                }
            }
        }
Пример #3
0
        private AccountRechareInfo getAccountRechare(string TranOrder)
        {
            AccountRechareInfo model     = null;
            string             strSQL    = " select Id,TranOrder,Amount from AccountRechare WITH(NOLOCK) WHERE TranOrder=@TranOrder";
            DynamicParameters  paramData = new DynamicParameters();

            paramData.Add("@TranOrder", TranOrder);
            model = PublicConn.QuerySingleWrite <AccountRechareInfo>(strSQL, ref paramData);
            return(model);
        }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var idStr = WEBRequest.GetString("projectid");

            if (!string.IsNullOrEmpty(idStr))
            {
                projectId = Guid.Parse(idStr);
            }
            else
            {
                Response.Redirect("/pages/invest/invest_list.aspx");
            }

            InvestType = WEBRequest.GetString("investType");

            var payMoneyStr = WEBRequest.GetString("payMoney");

            if (!string.IsNullOrEmpty(payMoneyStr))
            {
                PayMoney = decimal.Parse(payMoneyStr);
            }
            else
            {
                Response.Redirect("/pages/invest/invest_list.aspx");
            }

            ProfitMoney = WEBRequest.GetString("profitMoney");
            ProfitMoney = ProfitMoney.Replace("¥", "");
            try
            {
                if (ProfitMoney.ToText() != "" && !ProfitMoney.Contains("~"))
                {
                    //获取团币系数
                    NewVipUserInfo UserVipModel = GetNewVipUserInfo(WebUserAuth.UserId.Value);
                    decimal        tuanBiXiShu  = 0;
                    if (UserVipModel != null)
                    {
                        tuanBiXiShu = UserVipModel.TuanBiCoefficient;
                    }
                    TuanBi = Math.Floor(tuanBiXiShu * decimal.Parse(ProfitMoney)).ToString();
                }
            }
            catch
            {
                TuanBi = "0";
            }

            IsWeFQB = false;

            if (InvestType == "project")
            {
                #region 散标投资
                string sql = "select count(0) from Project with(nolock) where id=@id";
                Dapper.DynamicParameters para = new Dapper.DynamicParameters();
                para.Add("@id", projectId);
                var count = PublicConn.QuerySingle <int>(sql, ref para);
                if (count > 0)
                {
                    FinishUrl = "/pages/invest/detail.aspx?id=" + projectId;
                    sql       = "SELECT top 1 s.Id FROM dbo.Project p WITH(NOLOCK) INNER JOIN dbo.Subscribe s WITH(NOLOCK) ON p.Id = s.ProjectId WHERE p.Id=@id AND s.SubscribeUserId=@userid ORDER BY s.AddDate DESC";
                    para      = new Dapper.DynamicParameters();
                    para.Add("@id", projectId);
                    para.Add("@userid", WebUserAuth.UserId.Value);
                    var subscribeId = PublicConn.QuerySingleWrite <Guid>(sql, ref para);
                    InvestUrl =
                        "/Member/Repayment/my_return_details.aspx?SubscribeId=" + subscribeId + "&ProjectId=" + projectId + "&tab=Inprogress";
                    GoOnUrl = "/pages/invest/invest_list.aspx";

                    projectInfo = new ProjectBLL().GetProjectDetailInfo(projectId);
                    if (projectInfo.Type == 6 || projectInfo.Type == 19 || projectInfo.Type == 20 || projectInfo.Type == 21 || projectInfo.Type == 17)
                    {
                        TuanBi = TuanBi;
                    }
                    else
                    {
                        TuanBi = Math.Floor(decimal.Parse(TuanBi) / projectInfo.Deadline ?? 1).ToString();
                    }
                }
                else
                {
                    FinishUrl = "/pages/invest/zqzr_detail.aspx?projectid=" + projectId;
                    sql       = "SELECT top 1 t.m_Title,s.Id FROM dbo.t_SubScribeTransfer t WITH(NOLOCK) INNER JOIN dbo.Subscribe s WITH(NOLOCK) ON t.m_Id = s.TranId WHERE t.m_Id=@id AND s.SubscribeUserId=@userid  ORDER BY s.TranDate DESC";
                    para      = new Dapper.DynamicParameters();
                    para.Add("@id", projectId);
                    para.Add("@userid", WebUserAuth.UserId.Value);
                    var tModel = PublicConn.QuerySingleWrite <TranModel>(sql, ref para);
                    if (tModel != null)
                    {
                        InvestUrl =
                            "/Member/Repayment/my_debt_carry_detail.aspx?SubscribeId=" + tModel.Id + "&Title=" + tModel.m_Title + "&projectid=78ab9bb8-1b12-4574-9326-cbba119956d4&tab=Inprogress";
                    }
                    else
                    {
                        InvestUrl = "/Member/Repayment/my_return_list.aspx";
                    }
                    GoOnUrl = "/pages/invest/debt_list.aspx";

                    TuanBi = "0";
                }
                #endregion
            }
            else
            {
                #region We计划
                //product = new WeProductBLL().GetWeProductInfo(projectId);
                if (GlobalUtils.IsRedis && GlobalUtils.IsWePlanRedis)
                {
                    string err         = string.Empty;
                    var    weRedisInfo = TuanDai.RedisApi.Client.WePlanRedis.GetWePlanRedisByProductIdJson(projectId,
                                                                                                           out err, TdConfig.ApplicationName);
                    if (weRedisInfo != null)
                    {
                        product = JsonConvert.DeserializeObject <WeProductDetailInfo>(weRedisInfo);
                    }
                    if (product == null || !string.IsNullOrEmpty(err))
                    {
                        product = new WeProductBLL().GetWeProductInfo(projectId);
                    }
                }
                else
                {
                    product = new WeProductBLL().GetWeProductInfo(projectId);
                }
                var cookieUrl = CookieHelper.GetCookie("Anniversary4"); //HttpContext.Current.Request.Cookies["Anniversary4"];
                if (!string.IsNullOrEmpty(cookieUrl))
                {
                    activityUrl = cookieUrl;
                    //删除cookie Anniversary4
                    if (product.TypeWord.ToLower().Contains("p") || product.TypeWord.ToLower().Contains("q") || product.TypeWord.ToLower().Contains("r"))
                    {
                        CookieHelper.ClearCookie("Anniversary4");
                    }
                }
                string sql = "select count(0) from we_product with(nolock) where id=@id and iswefqb = 1";
                Dapper.DynamicParameters para = new Dapper.DynamicParameters();
                para.Add("@id", projectId);
                var count = PublicConn.QuerySingle <int>(sql, ref para);

                sql  = "select top 1 o.id from we_product p with(nolock) inner join we_order o with(nolock) on p.id=o.productid where p.id=@id and o.userid=@userid order by OrderDate desc";
                para = new Dapper.DynamicParameters();
                para.Add("@id", projectId);
                para.Add("@userid", WebUserAuth.UserId.Value);
                var orderId = PublicConn.QuerySingleWrite <Guid>(sql, ref para);
                if (count > 0)
                {
                    IsWeFQB   = true;
                    FinishUrl = "/pages/invest/WE/WeFqb_detail.aspx?id=" + projectId;
                    InvestUrl = "/Member/Repayment/Wefqb_project.aspx?weorderid=" + orderId + "&tab=Inprogress";
                }
                else
                {
                    FinishUrl = "/pages/invest/WE/WE_detail.aspx?id=" + projectId;
                    InvestUrl =
                        "/Member/Repayment/We_project.aspx?weorderid=" + orderId + "&tab=Inprogress";
                }
                GoOnUrl = "/pages/invest/WE/WE_list.aspx";

                if (product != null && (product.TuandaiCashRate ?? 0) > 0)
                {
                    if (product.CashLimitAmount == 0 || PayMoney >= product.CashLimitAmount)
                    {
                        FXAmount = PayMoney * product.TuandaiCashRate.Value / 100;
                    }
                }
                if (product != null)
                {
                    if (product.DeadType == 1)
                    {
                        TuanBi = Math.Floor(decimal.Parse(TuanBi) / product.Deadline ?? 1).ToString();
                    }
                    else
                    {
                        TuanBi = Math.Floor(decimal.Parse(TuanBi)).ToString();
                    }
                }
                #endregion
            }
            //计算红包状态
            QueryPrizeUseStatus();
        }
Пример #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        WebSettingInfo webSetting = new WebSettingBLL().GetWebSettingInfo("E27798C9-9301-4176-AC0B-6F3916F389EA");

        partnerConfig = new PartnerConfig(webSetting.Param1Value, webSetting.Param2Value, webSetting.Param3Value, webSetting.Param5Value);
        SortedDictionary <string, string> sPara = GetRequestPost();

        if (null == sPara)
        {
            Response.End();
        }

        if (sPara.Count > 0)//判断是否有带返回参数
        {
            NetLog.WriteBatchwithdrawHandler("接收连连支付异步通知数据", string.Concat("【", "签名:", sPara["sign"].ToString(), "签名方式:", sPara["sign_type"].ToString(), "我方订单号:", sPara["no_order"].ToString(), "充值金额:", sPara["money_order"].ToString(), "连连订单号:", sPara["oid_paybill"].ToString(), "】"));

            if (!PaymentUtil.CheckSign(sPara, partnerConfig.YTPublicKey, //验证失败
                                       partnerConfig.MD5Key))
            {
                var out_trade_no   = sPara["no_order"].ToString();
                var rechargeMoney  = sPara["money_order"].ToString();
                var transaction_id = sPara["oid_paybill"].ToString();

                //ObjectParameter outStatus = new ObjectParameter("outStatus", "0");
                //db.p_OnLineRechargeHandler(1, out_trade_no, decimal.Parse(rechargeMoney), transaction_id, outStatus);
                //int result = int.Parse(outStatus.Value.ToString());

                NetLog.WriteBatchwithdrawHandler("连连验签失败", string.Concat("签名:", sPara["sign"].ToString(), "签名方式:", sPara["sign_type"].ToString(), "连连处理状态:9999"));

                Response.Write(@"{""ret_code"":""9999"",""ret_msg"":""验签失败""}");
                Response.End();
            }
            else
            {
                var out_trade_no   = sPara["no_order"].ToString();
                var rechargeMoney  = sPara["money_order"].ToString();
                var transaction_id = sPara["oid_paybill"].ToString();

                string            strSQL   = "p_OnLineRechargeHandler";
                DynamicParameters dyParams = new DynamicParameters();
                dyParams.Add("@orderno", out_trade_no);
                dyParams.Add("@MediumMoney", decimal.Parse(rechargeMoney));
                dyParams.Add("@MediumOrderNo", transaction_id);
                dyParams.Add("@outStatus", 0, DbType.Int32, ParameterDirection.Output, 20);

                if (sPara["result_pay"].ToString().ToLower() == "success".ToLower())
                {
                    dyParams.Add("@handlerStatus", 2);
                }
                else
                {
                    dyParams.Add("@handlerStatus", 1);
                }
                PublicConn.ExecuteTD(PublicConn.DBWriteType.FundWrite, strSQL, ref dyParams, CommandType.StoredProcedure);
                int result = dyParams.Get <int>("@outStatus");

                AccountRechareInfo accountRechare = getAccountRechare(out_trade_no);
                if (accountRechare != null)
                {
                    var para = new DynamicParameters();
                    para.Add("@UserId", accountRechare.UserId);
                    var count = PublicConn.QuerySingleWrite <int>("select count(0) from AccountRechare with(nolock) where UserId=@UserId and Status =2   and type in (2, 3, 4, 6, 8, 12)", ref para);
                    if (count == 1)
                    {
                        TuanDai.PortalSystem.BLL.VipGetWorthBLL.AddGetWorth(accountRechare.UserId, (int)ConstString.UserGrowthType.FirstReCharge, null, 0);
                    }

                    UserBasicInfoInfo userBasicInfo = new UserBLL().GetUserBasicInfoModelById(accountRechare.UserId);
                    if (userBasicInfo != null)
                    {
                        var isNewSmsRequest = ConfigHelper.getConfigString("IsNewSmsRequest", "0");
                        if (isNewSmsRequest == "0")
                        {
                            var parameters = new Dictionary <string, object>();
                            parameters.Add("User", userBasicInfo);
                            parameters.Add("CurrentDate", DateTime.Now);
                            parameters.Add("RechargeMoney", rechargeMoney);
                            parameters.Add("Host", GlobalUtils.WebURL);

                            var messageSender = new BusinessDll.MessageSend();
                            messageSender.SendMessage2(eventCode: MessageTemplates.RechargeSuccess, parameters: parameters,
                                                       mobile: userBasicInfo.TelNo, email: userBasicInfo.Email, userId: userBasicInfo.Id);
                        }
                        else
                        {
                            SmsRequest rechargeSuccessSmsRequest = new SmsRequest();
                            rechargeSuccessSmsRequest.EventCode      = MsgTemplatesType.RechargeSuccess;
                            rechargeSuccessSmsRequest.PlatformSource = PlatformSource.Pc;
                            rechargeSuccessSmsRequest.UserId         = userBasicInfo.Id;
                            rechargeSuccessSmsRequest.EmailAddress   = userBasicInfo.Email;
                            rechargeSuccessSmsRequest.Mobile         = userBasicInfo.TelNo;
                            rechargeSuccessSmsRequest.Parameters     = new Dictionary <string, object>();
                            rechargeSuccessSmsRequest.Parameters.Add("RechargeMoney", rechargeMoney);

                            string errorMessage = string.Empty;
                            SmsClient.SendMessage(rechargeSuccessSmsRequest, ref errorMessage);
                        }



                        //第三方渠道回调
                        try
                        {
                            TuanDai.PortalSystem.BLL.ThirdPartyChannel.RechargeCallBack(accountRechare.Id, accountRechare.UserId);
                        }
                        catch (Exception ex)
                        {
                            new TuanDai.LogSystem.LogClient.LogClients().WriteErrorLog(
                                "TuanDai.PortalSystem.BLL.ThirdPartyChannel.RechargeCallBack",
                                "", "", ex.Message);
                        }
                    }
                }

                NetLog.WriteTraceLogHandler("交易成功", string.Concat("签名:", sPara["sign"].ToString(), "签名方式:", sPara["sign_type"].ToString(), "我方处理状态:", result.ToString().Trim(), "连连处理状态:", sPara["result_pay"].ToString()));
                Response.Write(@"{""ret_code"":""0000"",""ret_msg"":""交易成功""}");
                Response.End();
            }
        }
        else
        {
            //var out_trade_no = sPara["no_order"].ToString();
            //var rechargeMoney = sPara["money_order"].ToString();
            //var transaction_id = sPara["oid_paybill"].ToString();

            //ObjectParameter outStatus = new ObjectParameter("outStatus", "0");
            //db.p_OnLineRechargeHandler(1, out_trade_no, decimal.Parse(rechargeMoney), transaction_id, outStatus);
            ////Response.Write(@"{""ret_code"":""9999"",""ret_msg"":""验签失败""}");

            //int result = int.Parse(outStatus.Value.ToString());

            NetLog.WriteBatchwithdrawHandler("连连交易参数为空失败", "连连处理状态:9999");
            Response.Write(@"{""ret_code"":""9999"",""ret_msg"":""交易失败""}");
            Response.End();
        }

        // 解析异步通知对象
        // sPara 字典对象
        // TODO:更新订单,发货等后续处理
    }
Пример #6
0
        private void InitData()
        {
            try
            {
                WebSettingInfo webSetting = new WebSettingBLL().GetWebSettingInfo("fe5e5a30-b12c-4888-9858-12cbe80e1018");

                string MemberID       = Request.Params["MemberID"];          //商户号
                string TerminalID     = Request.Params["TerminalID"];        //商户终端号
                string TransID        = Request.Params["TransID"];           //商户流水号
                string Result         = Request.Params["Result"];            //支付结果(1:成功,0:失败)
                string ResultDesc     = Request.Params["ResultDesc"];        //支付结果描述
                string FactMoney      = Request.Params["FactMoney"];         //实际成交金额
                string AdditionalInfo = Request.Params["AdditionalInfo"];    //订单附加消息
                string SuccTime       = Request.Params["SuccTime"];          //交易成功时间
                string Md5Sign        = Request.Params["Md5Sign"].ToLower(); //md5签名
                string Md5Key         = "abcdefg";                           //webSetting.Param2Value;//ConfigurationManager.AppSettings["Md5key"];//密钥 双方约定
                String mark           = "~|~";                               //分隔符

                //string _Md5Key = "100000178";//测试商户号//webSetting.Param1Value;//WebConfigurationManager.AppSettings["Md5key"];

                string _WaitSign = "MemberID=" + MemberID + mark + "TerminalID=" + TerminalID + mark + "TransID=" + TransID + mark + "Result=" + Result + mark + "ResultDesc=" + ResultDesc + mark
                                   + "FactMoney=" + FactMoney + mark + "AdditionalInfo=" + AdditionalInfo + mark + "SuccTime=" + SuccTime
                                   + mark + "Md5Sign=" + Md5Key;

                SysLogHelper.WriteTraceLog("等待验签参数", _WaitSign);
                //验证签名成功
                if (Md5Sign.ToLower() == Md5Encrypt(_WaitSign).ToLower())
                {
                    ///支付结果(1:成功,0:失败)
                    DynamicParameters dyParams = new DynamicParameters();
                    string            strSQL   = "";
                    if (Result == "1")
                    {
                        strSQL   = "p_OnLineRechargeHandler";
                        dyParams = new DynamicParameters();
                        dyParams.Add("@handlerStatus", 2);
                        dyParams.Add("@MediumMoney", decimal.Divide(decimal.Parse(FactMoney), 100));
                        dyParams.Add("@MediumOrderNo", (TransID + SuccTime).Trim());
                        dyParams.Add("@outStatus", 0, DbType.Int32, ParameterDirection.Output, 20);

                        PublicConn.ExecuteTD(PublicConn.DBWriteType.FundWrite, strSQL, ref dyParams, CommandType.StoredProcedure);

                        int presult = dyParams.Get <int>("@outStatus");

                        SysLogHelper.WriteTraceLog("宝付支付交易成功", string.Concat("签名:", Md5Sign.ToLower(), "签名方式:", "MD5", "我方处理状态:", presult.ToString().Trim(), "宝付处理状态:", Result, "支付单号:", TransID));

                        AccountRechareInfo accountRechare = getAccountRechare(TransID);
                        if (accountRechare != null)
                        {
                            strSQL   = "select count(1) from AccountRechare where UserId=@userId and Status=2 and  [type] in(2, 3, 4, 6, 8, 12)";
                            dyParams = new DynamicParameters();
                            dyParams.Add("@userId", accountRechare.UserId);
                            int iCount = PublicConn.QuerySingleWrite <int>(strSQL, ref dyParams);
                            if (iCount > 0)
                            {
                                TuanDai.PortalSystem.BLL.VipGetWorthBLL.AddGetWorth(accountRechare.UserId, (int)ConstString.UserGrowthType.FirstReCharge, null, 0);
                            }
                            UserBasicInfoInfo userBasicInfo = new UserBLL().GetUserBasicInfoModelById(accountRechare.UserId);
                            if (userBasicInfo != null)
                            {
                                var isNewSmsRequest = ConfigHelper.getConfigString("IsNewSmsRequest", "0");
                                if (isNewSmsRequest == "0")
                                {
                                    var parameters = new Dictionary <string, object>();
                                    parameters.Add("CurrentDate", DateTime.Now);
                                    //parameters.Add("RechargeMoney", FactMoney);
                                    parameters.Add("RechargeMoney", decimal.Divide(decimal.Parse(FactMoney), 100));//宝付充值以分为单位
                                    parameters.Add("User", userBasicInfo);
                                    parameters.Add("Host", GlobalUtils.WebURL);

                                    var msgSender = new BusinessDll.MessageSend();
                                    msgSender.SendMessage2(eventCode: MessageTemplates.RechargeSuccess, parameters: parameters,
                                                           mobile: userBasicInfo.TelNo, email: userBasicInfo.Email, userId: userBasicInfo.Id);
                                }
                                else
                                {
                                    SmsRequest rechargeSuccessSmsRequest = new SmsRequest();
                                    rechargeSuccessSmsRequest.EventCode      = MsgTemplatesType.RechargeSuccess;
                                    rechargeSuccessSmsRequest.PlatformSource = PlatformSource.Pc;
                                    rechargeSuccessSmsRequest.UserId         = userBasicInfo.Id;
                                    rechargeSuccessSmsRequest.EmailAddress   = userBasicInfo.Email;
                                    rechargeSuccessSmsRequest.Mobile         = userBasicInfo.TelNo;
                                    rechargeSuccessSmsRequest.Parameters     = new Dictionary <string, object>();
                                    rechargeSuccessSmsRequest.Parameters.Add("RechargeMoney", FactMoney);

                                    string errorMessage = string.Empty;
                                    SmsClient.SendMessage(rechargeSuccessSmsRequest, ref errorMessage);
                                }
                            }
                        }
                        Response.Write("OK");
                        Response.End();
                    }

                    //if (Result == "0")
                    //{
                    //    db.p_OnLineRechargeHandler(1, TransID.Trim(), decimal.Divide(decimal.Parse(FactMoney), 100), (TransID + SuccTime).Trim(), outStatus);
                    //    int presult = int.Parse(outStatus.Value.ToString());
                    //    NetLog.WriteLoginHandler("宝付支付交易失败", string.Concat("签名:", Md5Sign.ToLower(), "签名方式:", "MD5", "我方处理状态:", presult.ToString().Trim(), "宝付处理状态:", Result, "支付单号:", TransID));

                    //    Response.Write("Fail");
                    //}
                }
                else
                {
                    SysLogHelper.WriteTraceLog("宝付验签失败", string.Concat("宝付返回签名:", Md5Sign.ToLower(), "等待验签", Md5Encrypt(_WaitSign).ToLower(), "签名方式:", "MD5", "宝付处理状态:", Result));
                    Response.Write("校验失败");
                    Response.End();
                }
            }
            catch (Exception ex)
            {
                SysLogHelper.WriteErrorLog("宝付支付失败", "错误详细信息:" + ex.Message + "|" + ex.StackTrace);
                Response.Write("Fail");
                Response.End();
            }
        }