public static string GiftToGame(int iUserID, string sGameAbbre, string sAccount, int iPoint, string sTranIP, string sChannelAbbre) { int iChannelID = ChannelBLL.ChannelIDSelByAbbre(sChannelAbbre); if (iChannelID < 20) { return("-3"); } string sGiftPointRes = TransPBLL.FirstGiftSend(iUserID, iPoint, sTranIP, iChannelID); string sRes = string.Empty; 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); }
public static string QuickPay(string sChannel, string sPhone, string sAccount, decimal dPrice, int iCount, string sBankName, string sGameNameC) { string sTranIP = ProvideCommon.GetRealIP(); string sTranDirect = string.Empty; string sGameName = sGameNameC.Split('|')[0]; switch (sChannel) { case "alipay": case "ibank": string sPTranID = TransPBLL.PointSalesInit(sChannel, sPhone, sAccount, dPrice, iCount, sTranIP); decimal dFeeScale = ChannelBLL.FeeScaleSel(sChannel); int iGamePoints = Convert.ToInt32(dPrice * 10 * dFeeScale); int iPayUserID = UserBll.UserIDSel(sAccount); string sGTranID = TransGBLL.GameSalesInit(sGameName, iGamePoints, sAccount, sPhone, iPayUserID, sTranIP); TranQuickBLL.TranQuickAdd(sGTranID, sPTranID); sTranDirect = AliPay.QuickPayDirect(sPTranID, dPrice, sChannel, sBankName, sAccount, sGameNameC); break; case "yp-szx": case "yp-dx": case "yp-lt": case "yp-zt": case "yp-sd": case "yp-jcard": case "yp-bank": sTranDirect = YeePayBuy.QuickPayDirect(sChannel, sPhone, sAccount, dPrice, iCount, sGameNameC); break; case "szfbank": string sTranID = TransPBLL.PointSalesInit(sChannel, sPhone, sAccount, dPrice, iCount, sTranIP); dFeeScale = ChannelBLL.FeeScaleSel(sChannel); iGamePoints = Convert.ToInt32(dPrice * 10 * dFeeScale); iPayUserID = UserBll.UserIDSel(sAccount); sGTranID = TransGBLL.GameSalesInit(sGameName, iGamePoints, sAccount, sPhone, iPayUserID, sTranIP); TranQuickBLL.TranQuickAdd(sGTranID, sTranID); sTranDirect = QdbPayBuy.QuickPayBegin(sTranID, sAccount, dPrice, sGameNameC); break; case "vpay": string sOrderID = TransPBLL.PointSalesInit(sChannel, sPhone, sAccount, dPrice, iCount, sTranIP); dFeeScale = ChannelBLL.FeeScaleSel(sChannel); iGamePoints = Convert.ToInt32(dPrice * 10 * dFeeScale); iPayUserID = UserBll.UserIDSel(sAccount); sGTranID = TransGBLL.GameSalesInit(sGameName, iGamePoints, sAccount, sPhone, iPayUserID, sTranIP); TranQuickBLL.TranQuickAdd(sGTranID, sOrderID); sTranDirect = VPayBuy.QuickPayBegin(sOrderID, sAccount, dPrice, sGameNameC); break; } return(sTranDirect); }
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); }