Ejemplo n.º 1
0
        public static string TenPaySubmit(HttpContext Context)
        {
            string sRes = string.Empty;

            //创建PayResponseHandler实例
            PayResponseHandler resHandler = new PayResponseHandler(Context);

            resHandler.setKey(key);

            //判断签名
            if (resHandler.isTenpaySign())
            {
                //交易单号
                string transaction_id = resHandler.getParameter("transaction_id");

                //金额,以分为单位
                string total_fee = resHandler.getParameter("total_fee");

                //支付结果
                string pay_result = resHandler.getParameter("pay_result");

                string sp_billno = resHandler.getParameter("sp_billno");

                string attach = resHandler.getParameter("attach");
                if ("0".Equals(pay_result))
                {
                    //注意交易单不要重复处理
                    //注意判断返回金额
                    string  sTranID  = string.Format("{0}{1}", sp_billno, attach.Split('|')[0]);
                    decimal dPrice   = decimal.Parse(total_fee) / 100;
                    string  sAccount = attach.Split('|')[1];
                    int     j        = TransPBLL.PointSalesCommit(sTranID, sAccount, dPrice); //确认返回信息无误后提交此定单
                    if (0 == j)
                    {
                        resHandler.doShow(string.Format("PayPSucc.aspx?TranID={0}", sTranID));
                    }
                    sRes = j.ToString();
                }
                else
                {
                    sRes = "-1";
                }
            }
            else
            {
                sRes = "-2";
            }
            return(sRes);
        }
Ejemplo n.º 2
0
        public static string VPayVal()
        {
            string sRes = string.Empty;
            //'接受服务器url get参数
            string        rtmd5    = CYRequest.GetString("v1");  //   '服务器MD5
            string        trka     = CYRequest.GetString("v2");  //  'V币号码15位
            string        rtmi     = CYRequest.GetString("v3");  //   '密码'V币密码6位 (可能为空 老V币没有密码)
            string        rtmz     = CYRequest.GetString("v4");  //  '面值1-999 整数
            string        rtlx     = CYRequest.GetString("v5");  //  '卡的类型  1 2 3
            string        rtoid    = CYRequest.GetString("v6");  // '网盈一号通服务器端订单
            string        rtcoid   = CYRequest.GetString("v7");  //  '商户自己订单
            string        rtuserid = CYRequest.GetString("v8");  // '商户的用户ID
            string        rtcustom = CYRequest.GetString("v9");  //'商户自己定义数据
            string        rtflag   = CYRequest.GetString("v10"); // '返回状态. 1正常发送 2补单发送
            StringBuilder sbText   = new StringBuilder();

            sbText.Append(trka);
            sbText.Append(rtmi);
            sbText.Append(rtoid);
            sbText.Append(spid);
            sbText.Append(sppwd);
            sbText.Append(rtcoid);
            sbText.Append(rtflag);
            sbText.Append(rtmz);
            string  get_key     = sbText.ToString();                    //string get_key = trka + rtmi + rtoid + spid + sppwd + rtcoid + rtflag + rtmz;
            string  md5password = ProvideCommon.MD5(get_key).ToUpper(); //  '先MD5 32 然后转大写
            string  sAccount    = rtuserid;                             //获取充值人账户
            decimal dPrice      = 0;

            decimal.TryParse(rtmz, out dPrice);
            if (rtflag == "1" || rtflag == "2")
            {
                if (md5password == rtmd5)
                {
                    string sTranID = string.Format("{0}{1}", rtcoid, rtcustom.Split('|')[0]);
                    int    j       = TransPBLL.PointSalesCommit(sTranID, sAccount, dPrice); //确认返回信息无误后提交此定单
                    sRes = j.ToString();
                }
                else
                {
                    sRes = string.Format("{0}|{1}", md5password, rtmd5);
                }
            }
            else
            {
                sRes = string.Format("rtflag:{0}", rtflag);
            }
            return(sRes);
        }
Ejemplo n.º 3
0
        public static string Pay(string sTID, int iPoint, int iUserID, string sOfferName)
        {
            string sRes = string.Empty;

            if (iPoint > 2000)
            {
                sRes = string.Format("{\"uid\":\"{0}\",\"vcpoints\":\"{1}\",\"tid\":\"{2}\",\"offer_name\":\"{3}\",\"status\":\"1004\"}",
                                     iUserID, iPoint, sTID, sOfferName);
            }
            else
            {
                decimal dPrice  = Convert.ToDecimal(iPoint / 10);
                string  sTranIP = ProvideCommon.GetRealIP();
                string  sTranID = TransPBLL.YRTSalesInit(iUserID, iPoint, dPrice, sTranIP);
                if (sTranID.Length < 10)
                {
                    return("tranid init err");
                }
                YRTPay yrtPayObject = new YRTPay();
                yrtPayObject.OfferName = sOfferName;
                yrtPayObject.Point     = iPoint;
                yrtPayObject.TID       = sTID;
                yrtPayObject.TranID    = sTranID;
                yrtPayObject.TranIP    = ProvideCommon.GetRealIP();
                yrtPayObject.TranTime  = DateTime.Now;
                yrtPayObject.UserID    = iUserID;
                int iAddNum = YRTPayAdd(yrtPayObject);
                if (iAddNum > 0)
                {
                    int iTranRes = TransPBLL.YRTSalesCommit(sTranID, iUserID, iPoint);
                    if (iTranRes == 0)
                    {
                        sRes = string.Format("{\"uid\":\"{0}\",\"vcpoints\":\"{1}\",\"tid\":\"{2}\",\"offer_name\":\"{3}\",\"status\":\"success\"}",
                                             iUserID, iPoint, sTID, sOfferName);
                    }
                    else
                    {
                        sRes = iTranRes.ToString();
                    }
                }
                else
                {
                    sRes = string.Format("{\"uid\":\"{0}\",\"vcpoints\":\"{1}\",\"tid\":\"{2}\",\"offer_name\":\"{3}\",\"status\":\"yrtpay insert err\"}",
                                         iUserID, iPoint, sTID, sOfferName);
                }
            }
            return(sRes);
        }
Ejemplo n.º 4
0
        public static string Login(string sUserID, string sGame, bool bRes)
        {
            string        site     = GetSite(sGame);
            string        key      = "DNTQ-16DD11-WAN-0668-daoDS50N-7ROAD-shenLQg-111SHEN";
            string        user     = sUserID;
            string        password = Guid.NewGuid().ToString("D");
            string        time     = ProvideCommon.getTime().ToString();
            StringBuilder sbText   = new StringBuilder();

            sbText.Append(user);
            sbText.Append(password);
            sbText.Append(time);
            sbText.Append(key);
            string sign    = ProvideCommon.MD5(sbText.ToString());//user+password+time+key
            string context = string.Format("{0}|{1}|{2}|{3}", user, password, time, sign);
            string sHost   = GetDomain(sGame);
            string preUrl  = string.Format("http://{0}/createlogin", sHost);

            sbText.Remove(0, sbText.Length);
            sbText.AppendFormat("content={0}&site={1}", context, site);
            int iUserID = 0;
            int iIsPay  = 0;

            if (int.TryParse(sUserID, out iUserID))
            {
                string sTranID = TransPBLL.SelIsTranByUID(iUserID);
                if (sTranID.Length > 32)
                {
                    iIsPay = 1;
                }
            }
            sbText.AppendFormat("&isCharge={0}", iIsPay.ToString());
            string sRes = ProvideCommon.GetPageInfoByPost(preUrl, sbText.ToString(), "UTF-8");

            if (sRes == "0")
            {
                string Url = string.Format("http://{0}/client/game.jsp?user={1}&key={2}&site={3}", sHost, user, password, site);
                if (bRes)
                {
                    GameLoginBLL.GameLoginAdd(iUserID, sGame, ProvideCommon.GetRealIP(), Url);
                }
                return(Url);
            }
            else
            {
                return(string.Format("http://www.dao50.com/fwqwh/?{0}|{1}", preUrl, sbText.ToString()));
            }
        }
Ejemplo n.º 5
0
        public static void pointpaysend(string sPTranID)
        {
            TransP tpObject = TransPBLL.UserTranSel(sPTranID);
            string sReturn  = string.Empty;

            if (tpObject.state == 1)
            {
                string        sUrl   = "http://union.dao50.com/tarns/transPoints.aspx";
                StringBuilder sbText = new StringBuilder();
                sbText.AppendFormat("orderid={0}&", tpObject.TranID.Trim());
                sbText.AppendFormat("userid={0}&", tpObject.UserID);
                sbText.AppendFormat("ordertime={0}&", tpObject.TranTime);
                sbText.AppendFormat("channel={0}&", tpObject.ChannelID);
                sbText.AppendFormat("price={0}&", tpObject.price);
                sbText.AppendFormat("points={0}&", tpObject.TranPoints);
                sbText.AppendFormat("giftpoints={0}&", tpObject.TranGiftPoints);
                sbText.AppendFormat("tranip={0}", tpObject.TranIP);
                sReturn = string.Format("{0}?{1}", sUrl, sbText.ToString());
            }
            ProvideCommon.GetPageInfo(sReturn);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 用户真实点数查询
        /// </summary>
        /// <param name="iUserID"></param>
        /// <returns></returns>
        public static int URealPointsSel(int iUserID)
        {
            int iPoints = 0;

            if (iUserID > 999)
            {
                int iPPoints = TransPBLL.TranPSelPointsByUser(iUserID);
                int iGPoints = TransGBLL.TransSelGPointsByUser(iUserID);
                if (iPPoints == -1 || iGPoints == 1)
                {
                    iPoints = -1;
                }
                else
                {
                    iPoints = iPPoints + iGPoints;
                }
            }
            else
            {
                iPoints = -1;
            }
            return(iPoints);
        }
Ejemplo n.º 7
0
        public static string GiftToGame(int iUserID, string sGameAbbre, string sAccount, int iPoint, string sTranIP)
        {
            string sRes          = string.Empty;
            string sGiftPointRes = TransPBLL.GiftPointsSend(iUserID, iPoint, sTranIP);

            if (sGiftPointRes == "0")
            {
                string sGiftGameRes = PayAll.GamePay(sGameAbbre, iUserID, sAccount, iPoint, "", iUserID);
                if (sGiftGameRes.Split('|')[0] == "0")
                {
                    sRes = "0";
                }
                else
                {
                    UserPointsBLL.UGiftPointUpdate(iUserID, 0);
                    sRes = string.Format(string.Format("-2|{0}", sGiftGameRes));
                }
            }
            else
            {
                sRes = string.Format("-1|{0}", sGiftPointRes);
            }
            return(sRes);
        }
Ejemplo n.º 8
0
        public static string QuickTenPaySubmit(HttpContext Context)
        {
            string sRes = string.Empty;

            //创建PayResponseHandler实例
            PayResponseHandler resHandler = new PayResponseHandler(Context);

            resHandler.setKey(key);

            //判断签名
            if (resHandler.isTenpaySign())
            {
                //交易单号
                string transaction_id = resHandler.getParameter("transaction_id");

                //金额金额,以分为单位
                string total_fee = resHandler.getParameter("total_fee");

                //支付结果
                string pay_result = resHandler.getParameter("pay_result");

                string sp_billno = resHandler.getParameter("sp_billno");

                string attach = resHandler.getParameter("attach");
                if ("0".Equals(pay_result))
                {
                    //------------------------------
                    //处理业务开始
                    //------------------------------

                    //注意交易单不要重复处理
                    //注意判断返回金额

                    //------------------------------
                    //处理业务完毕
                    //------------------------------
                    string  sTranID    = string.Format("{0}{1}", sp_billno, attach.Split('|')[0]);
                    decimal dPrice     = decimal.Parse(total_fee) / 100;
                    string  sAccount   = attach.Split('|')[1];
                    string  sGameAbbre = attach.Split('|')[2];

                    string sTranIP  = ProvideCommon.GetRealIP();
                    string sFromUrl = Context.Request.Url.ToString();
                    LastOfPayPointBLL.Add(sTranIP, ' ', sFromUrl, sTranID);

                    int j = TransPBLL.PointSalesCommit(sTranID, sAccount, dPrice);
                    if (0 == j)
                    {
                        string sGTranID = TranQuickBLL.TranQuickGTranIDSel(sTranID);
                        TranQuickBLL.TranQuickUpdateP(sTranID);
                        string sGTRes = string.Empty;
                        if (sGameAbbre.IndexOf("sq") == -1)
                        {
                            sGTRes = PayAll.GameQuickPay(sGameAbbre, sAccount, dPrice, sGTranID);
                        }
                        else
                        {
                            string sRoleID = attach.Split('|')[3];
                            sGTRes = PayAll.sqQuickPay(sGameAbbre, sAccount, dPrice, sGTranID, sRoleID);
                        }

                        string sUrl = string.Empty;
                        if (sGTRes == "0")
                        {
                            TranQuickBLL.TranQuickUpdateG(sGTranID);
                            sUrl = string.Format("PayGSucc.aspx?TranID={0}&gn={1}&type=q", sGTranID, sGameAbbre);
                            //调用doShow, 打印meta值跟js代码,告诉财付通处理成功,并在用户浏览器显示$show页面.
                            resHandler.doShow(sUrl);
                        }
                        sRes = sGTRes;
                    }
                    else if (j == 6)
                    {
                        string sQuickState = TranQuickBLL.TransQuickStateSelByP(sTranID);
                        string sGTranID    = TranQuickBLL.TranQuickGTranIDSel(sTranID);
                        if (sQuickState == "2")
                        {
                            string sUrl = string.Format("PayGSucc.aspx?TranID={0}&gn={1}&type=q", sGTranID, sGameAbbre);
                            //调用doShow, 打印meta值跟js代码,告诉财付通处理成功,并在用户浏览器显示$show页面.
                            resHandler.doShow(sUrl);
                            sRes = "0";
                        }
                        else if (sQuickState == "1")
                        {
                            string sGTRes = string.Empty;
                            if (sGameAbbre.IndexOf("sq") == -1)
                            {
                                sGTRes = PayAll.GameQuickPay(sGameAbbre, sAccount, dPrice, sGTranID);
                            }
                            else
                            {
                                string sRoleID = attach.Split('|')[3];
                                sGTRes = PayAll.sqQuickPay(sGameAbbre, sAccount, dPrice, sGTranID, sRoleID);
                            }

                            if (sGTRes == "0") //游戏兑换成功
                            {
                                TranQuickBLL.TranQuickUpdateG(sGTranID);
                                string sUrl = string.Format("PayGSucc.aspx?TranID={0}&gn={1}&type=q", sGTranID, sGameAbbre);
                                //调用doShow, 打印meta值跟js代码,告诉财付通处理成功,并在用户浏览器显示$show页面.
                                resHandler.doShow(sUrl);
                                sRes = "0";
                            }
                            else
                            {
                                //sMsg = "<script>alert('充值武林币成功!游戏兑换失败!如有问题请与客服联系!');</script>";
                                sRes = "-3";
                            }
                        }
                    }
                    else
                    {
                        sRes = "-4";
                    }
                }
                else
                {
                    //当做不成功处理
                    sRes = "-1";
                }
            }
            else
            {
                sRes = "-2";
            }
            return(sRes);
        }
Ejemplo n.º 9
0
        public static string QuickYeePaySubmit()
        {
            string sRes = string.Empty;
            // 校验返回数据包
            BuyCallbackResult result = Buy.VerifyCallback(p1_MerId, keyValue, Buy.GetQueryString("r0_Cmd"), Buy.GetQueryString("r1_Code"), Buy.GetQueryString("r2_TrxId"),
                                                          Buy.GetQueryString("r3_Amt"), Buy.GetQueryString("r4_Cur"), Buy.GetQueryString("r5_Pid"), Buy.GetQueryString("r6_Order"), Buy.GetQueryString("r7_Uid"),
                                                          Buy.GetQueryString("r8_MP"), Buy.GetQueryString("r9_BType"), Buy.GetQueryString("rp_PayDate"), Buy.GetQueryString("hmac"));

            if (string.IsNullOrEmpty(result.ErrMsg))    //校验返回数据包成功
            {
                StringBuilder sbText = new StringBuilder();
                if (result.R1_Code == "1")  //返回充值成功的标识
                {
                    decimal dPrice   = decimal.Parse(result.R3_Amt);
                    int     iPrice   = Convert.ToInt32(dPrice);
                    string  sChannel = string.Empty;
                    switch (Buy.GetQueryString("rb_BankId"))
                    {
                    case "SZX-NET":
                        sChannel = "yp-szx";
                        break;

                    case "TELECOM-NET":
                        sChannel = "yp-dx";
                        break;

                    case "UNICOM-NET":
                        sChannel = "yp-lt";
                        break;

                    case "ZHENGTU-NET":
                        sChannel = "yp-zt";
                        break;

                    case "SNDACARD-NET":
                        sChannel = "yp-sd";
                        break;

                    case "JUNNET-NET":
                        sChannel = "yp-jcard";
                        break;

                    default:
                        sChannel = "";
                        break;
                    }
                    if (sChannel != "")
                    {
                        dPrice = dPrice * ChannelBLL.FeeScaleSel(sChannel);
                    }
                    if (result.R9_BType == "1")  //返回方式1:浏览器重定向方式
                    {
                        string sPTranID = result.R6_Order;
                        string sAccount = result.R8_MP.Split('|')[0];
                        string sGame    = result.R8_MP.Split('|')[1];
                        int    iResNum  = TransPBLL.PointSalesCommit(sPTranID, sAccount, iPrice);
                        string sGTranID = TranQuickBLL.TranQuickGTranIDSel(sPTranID);
                        if (0 == iResNum)
                        {
                            TranQuickBLL.TranQuickUpdateP(sPTranID);
                            string sGTRes = string.Empty;
                            if (sGame.IndexOf("sq") == -1)
                            {
                                sGTRes = PayAll.GameQuickPay(sGame, sAccount, dPrice, sGTranID);
                            }
                            else
                            {
                                string sRoleID = result.R8_MP.Split('|')[2];
                                sGTRes = PayAll.sqQuickPay(sGame, sAccount, dPrice, sGTranID, sRoleID);
                            }
                            if (sGTRes == "0")
                            {
                                TranQuickBLL.TranQuickUpdateG(sGTranID);
                                sbText.Append("1|");
                            }
                            else
                            {
                                //游戏冲值失败
                                sbText.Append("3|");
                            }
                            sbText.Append(sGTranID);
                            sbText.AppendFormat("|{0}", sGame);
                            sRes = sbText.ToString();
                        }
                        else
                        {
                            string sQuickState = TranQuickBLL.TransQuickStateSelByP(sPTranID);
                            if (sQuickState == "2")
                            {
                                //游戏充值成功
                                sbText.Append("1|");
                                sbText.Append(sGTranID);
                                sbText.AppendFormat("|{0}", sGame);
                                sRes = sbText.ToString();
                            }
                            else if (sQuickState == "1")
                            {
                                string sGTRes = string.Empty;
                                if (sGame.IndexOf("sq") == -1)
                                {
                                    sGTRes = PayAll.GameQuickPay(sGame, sAccount, dPrice, sGTranID);
                                }
                                else
                                {
                                    string sRoleID = result.R8_MP.Split('|')[2];
                                    sGTRes = PayAll.sqQuickPay(sGame, sAccount, dPrice, sGTranID, sRoleID);
                                }
                                if (sGTRes == "0") //游戏兑换成功
                                {
                                    TranQuickBLL.TranQuickUpdateG(sGTranID);
                                    //游戏充值成功
                                    sbText.Append("1|");
                                }
                                else
                                {
                                    //游戏冲值失败
                                    sbText.Append("3|");
                                }
                                sbText.Append(sGTranID);
                                sbText.AppendFormat("|{0}", sGame);
                                sRes = sbText.ToString();
                            }
                            else
                            {
                                sbText.Append("2|");
                                sbText.Append(sPTranID);
                                sRes = sbText.ToString();
                            }
                        }
                    }
                    else if (result.R9_BType == "2")
                    {
                        string sAccount = result.R8_MP.Split('|')[0];
                        string sGame    = result.R8_MP.Split('|')[1];
                        string sPTranID = result.R6_Order;
                        int    iRes     = TransPBLL.PointSalesCommit(sPTranID, sAccount, iPrice);
                        string sGTranID = TranQuickBLL.TranQuickGTranIDSel(sPTranID);
                        if (iRes == 0)
                        {
                            TranQuickBLL.TranQuickUpdateP(sPTranID);
                            string sGTRes = string.Empty;
                            if (sGame.IndexOf("sq") == -1)
                            {
                                sGTRes = PayAll.GameQuickPay(sGame, sAccount, dPrice, sGTranID);
                            }
                            else
                            {
                                string sRoleID = result.R8_MP.Split('|')[2];
                                sGTRes = PayAll.sqQuickPay(sGame, sAccount, dPrice, sGTranID, sRoleID);
                            }
                            if (sGTRes == "0")
                            {
                                TranQuickBLL.TranQuickUpdateG(sGTranID);
                            }
                        }
                        sRes = "4";
                    }
                    else if (result.R9_BType == "3")
                    {
                        sRes = "4";
                    }
                }
                else
                {
                    sbText.Append("0|");
                    sbText.Append(result.R1_Code);
                    sRes = sbText.ToString();
                }
            }
            else
            {
                sRes = "0|valerr";
            }
            return(sRes);
        }
Ejemplo n.º 10
0
        public static string YeePaySubmit()
        {
            string sRes = string.Empty;
            // 校验返回数据包
            BuyCallbackResult result = Buy.VerifyCallback(p1_MerId, keyValue, Buy.GetQueryString("r0_Cmd"), Buy.GetQueryString("r1_Code"), Buy.GetQueryString("r2_TrxId"),
                                                          Buy.GetQueryString("r3_Amt"), Buy.GetQueryString("r4_Cur"), Buy.GetQueryString("r5_Pid"), Buy.GetQueryString("r6_Order"), Buy.GetQueryString("r7_Uid"),
                                                          Buy.GetQueryString("r8_MP"), Buy.GetQueryString("r9_BType"), Buy.GetQueryString("rp_PayDate"), Buy.GetQueryString("hmac"));

            if (string.IsNullOrEmpty(result.ErrMsg))    //校验返回数据包成功
            {
                StringBuilder sbText = new StringBuilder();
                if (result.R1_Code == "1")      //返回充值成功的标识
                {
                    if (result.R9_BType == "1") //返回方式1:浏览器重定向方式
                    {
                        string  sTranID  = result.R6_Order;
                        decimal dPrice   = decimal.Parse(result.R3_Amt);
                        string  sAccount = result.R8_MP;
                        int     iResNum  = TransPBLL.PointSalesCommit(sTranID, sAccount, dPrice);
                        if (0 == iResNum)
                        {
                            sbText.Append("1|");
                            sbText.Append(result.R6_Order);
                            sRes = sbText.ToString();
                        }
                        else
                        {
                            if (6 == iResNum)
                            {
                                sbText.Append("1|");
                                sbText.Append(result.R6_Order);
                                sRes = sbText.ToString();
                            }
                            else
                            {
                                sbText.Append("2|");
                                sbText.Append(result.R6_Order);
                                sRes = sbText.ToString();
                            }
                        }
                    }
                    else if (result.R9_BType == "2")
                    {
                        int iRes = TransPBLL.PointSalesCommit(result.R6_Order, result.R8_MP, decimal.Parse(result.R3_Amt));
                        sRes = "4";
                    }
                    else if (result.R9_BType == "3")
                    {
                        sRes = "4";
                    }
                }
                else
                {
                    sbText.Append("0|");
                    sbText.Append(result.R1_Code);
                    sRes = sbText.ToString();
                }
            }
            else
            {
                sRes = "0|valerr";
            }
            return(sRes);
        }