コード例 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (LoginSessionVal() || isLoginCookie())
     {
         if (Request.HttpMethod == "POST")
         {
             int    iPayUserID = GetUserID();                            //支付游戏的账号
             string sAccount   = CYRequest.GetFormString("gameaccount"); //充值游戏账号
             string sGameAbbre = CYRequest.GetFormString("gameservername");
             int    iUserID    = UserBll.UserIDSel(sAccount);            //充值游戏数字账号
             if (iUserID < 1000)
             {
                 //sMsg = "<script>alert('充值游戏账号不存在!');location.href='default.aspx';</script>";
                 Response.Redirect("PayGErr.aspx?err=201");
                 return;
             }
             else
             {
                 string sGameIsLogin = PayAll.ValUserLoginGame(sGameAbbre, iUserID.ToString());
                 if ("1" == sGameIsLogin)
                 {
                     //sMsg = "<script>alert('充值的游戏未创建角色,请先创建角色!谢谢!');location.href='default.aspx';</script>";
                     Response.Redirect("PayGErr.aspx?err=202");
                     return;
                 }
             }
             string sPhone      = CYRequest.GetFormString("gamephone");
             string sPayNums    = CYRequest.GetFormString("gamepaynums"); //平台币充值到游戏
             string sPayAccount = GetAccount();                           //支付平台币账号
             int    iPayPoints  = 0;
             int.TryParse(sPayNums, out iPayPoints);
             int iPUserPoints = UserPointsBLL.UPointAllSel(iPayUserID);
             if (iPUserPoints > 0)
             {
                 if (!UserPointsBLL.UPointCheck(iPayUserID))
                 {
                     //sMsg = "<script>alert('网络繁忙!武林币获取失败!请一会在试,谢谢!');location.href='default.aspx';</script>";
                     Response.Redirect("PayGErr.aspx?err=203");
                     return;
                 }
             }
             else
             {
                 //sMsg = "<script>alert('账号余额为0!请充值武林币!');location.href='default.aspx';</script>";
                 Response.Redirect("PayGErr.aspx?err=204");
                 return;
             }
             if (iPUserPoints >= iPayPoints && (iPayPoints > 79 || iPayUserID < 10000))
             {
                 string sReturn = string.Empty;
                 if (sGameAbbre.IndexOf("sq") == -1)
                 {
                     sReturn = PayAll.GamePay(sGameAbbre, iPayUserID, sPayAccount, iPayPoints, sPhone, iUserID);
                 }
                 else
                 {
                     string sRoleID = CYRequest.GetFormString("gamerole");
                     if (sRoleID == "" || sRoleID == "unsafe string")
                     {
                         //sMsg = "<script>alert('角色名错误!');location.href='default.aspx';</script>";
                         Response.Redirect("PayGErr.aspx?err=205");
                         return;
                     }
                     else
                     {
                         sReturn = PayAll.sqPay(sGameAbbre, iPayUserID, sPayAccount, iPayPoints, sPhone, iUserID, sRoleID);
                     }
                 }
                 string sRes = sReturn.Split('|')[0];
                 if (sRes == "0")
                 {
                     Server.Transfer(string.Format("PayGSucc.aspx?gname={0}&TranID={1}&gn={2}", sGameAbbre, sReturn.Split('|')[1], sGameAbbre));
                 }
                 else
                 {
                     //sMsg = "<script>alert('游戏充值失败,如有问题请联系客服!');location.href='default.aspx';</script>";
                     Response.Redirect("PayGErr.aspx?err=206");
                     return;
                 }
             }
             else
             {
                 SetPoints(iPUserPoints);
                 //sMsg = "<script>alert('账号余额不足!请充值武林币!');location.href='default.aspx';</script>";
                 Response.Redirect("PayPErr.aspx?err=204");
                 return;
             }
         }
     }
     else
     {
         //sMsg = "<script>alert('充值账号不存在!');location.href='default.aspx';</script>";
         Response.Redirect("PayGErr.aspx?err=201");
         return;
     }
 }
コード例 #2
0
        public void ProcessRequest(HttpContext context)
        {
            if (context.Request.HttpMethod == "POST")
            {
                string sFromHost = context.Request.UrlReferrer.Host;
                context.Response.Cookies["fromhost"].Value   = sFromHost;
                context.Response.Cookies["fromhost"].Expires = DateTime.Now.AddHours(1);
                string sAccount = CYRequest.GetFormString("quickaccount");//充值账号
                int    iUserID  = UserBll.UserIDSel(sAccount);
                if (iUserID < 1000)
                {
                    context.Response.Write("<script>alert('充值账号不存在!');</script>");
                    return;
                }

                string  sPayNums = CYRequest.GetFormString("quickpayprice");//充值金额
                decimal dPrice   = 0;
                decimal.TryParse(sPayNums, out dPrice);
                if (dPrice < 10)
                {
                    context.Response.Redirect("PayPErr.aspx?err=204");
                    return;
                }

                string sGameAbbre   = CYRequest.GetFormString("quickservername");
                string sGameIsLogin = PayAll.ValUserLoginGame(sGameAbbre, iUserID.ToString());
                if ("1" == sGameIsLogin)
                {
                    context.Response.Redirect("PayGErr.aspx?err=202");
                    return;
                }

                string sGameAbbreC = string.Empty;
                if (sGameAbbre.IndexOf("sq") == -1)
                {
                    sGameAbbreC = sGameAbbre;
                }
                else
                {
                    string sRoleID = CYRequest.GetFormString("quickrole");
                    sGameAbbreC = string.Format("{0}|{1}", sGameAbbre, sRoleID);
                }
                string sPhone    = CYRequest.GetFormString("quickphone");
                string sChannel  = CYRequest.GetFormString("quickchannel");
                int    iCount    = 1;
                string sBankName = string.Empty;
                if (sChannel == "ibank")
                {
                    sBankName = CYRequest.GetFormString("quickbank");
                }
                string sPayDirect = string.Empty;
                if (sChannel == "tenpay")
                {
                    string  sTranIP     = ProvideCommon.GetRealIP();
                    string  sPTranID    = TransPBLL.PointSalesInit(sChannel, sPhone, sAccount, dPrice, iCount, sTranIP);
                    decimal dFeeScale   = ChannelBLL.FeeScaleSel(sChannel);
                    int     iGamePoints = System.Convert.ToInt32(dPrice * 10 * dFeeScale);
                    int     iPayUserID  = UserBll.UserIDSel(sAccount);
                    string  sGTranID    = TransGBLL.GameSalesInit(sGameAbbre, iGamePoints, sAccount, sPhone, iPayUserID, sTranIP);
                    TranQuickBLL.TranQuickAdd(sGTranID, sPTranID);
                    sPayDirect = TenPayBuy.QuickPayBegin(sPTranID, sAccount, dPrice, sGameAbbreC, context);
                }
                else if (sChannel == "szfphone")
                {
                    string  sTranIP     = ProvideCommon.GetRealIP();
                    string  sPTranID    = TransPBLL.PointSalesInit(sChannel, sPhone, sAccount, dPrice, iCount, sTranIP);
                    decimal dFeeScale   = ChannelBLL.FeeScaleSel(sChannel);
                    int     iGamePoints = System.Convert.ToInt32(dPrice * 10 * dFeeScale);
                    int     iPayUserID  = UserBll.UserIDSel(sAccount);
                    string  sGTranID    = TransGBLL.GameSalesInit(sGameAbbre, iGamePoints, sAccount, sPhone, iPayUserID, sTranIP);
                    TranQuickBLL.TranQuickAdd(sGTranID, sPTranID);
                    string cardTypeCombine = CYRequest.GetFormString("quickcardTypeCombine");
                    sPayDirect = SzfPayBuy.QuickPayBegin(sPTranID, sAccount, dPrice, sGameAbbreC, "0", cardTypeCombine);
                }
                else
                {
                    sPayDirect = PayAll.QuickPay(sChannel, sPhone, sAccount, dPrice, iCount, sBankName, sGameAbbreC);
                }
                context.Response.Write(sPayDirect);
            }
        }