public static string Pay(string sUserID, decimal dMoney, string sOrderID, string sGame, string playerId) { string yx = "dao50";//运营商标识 string userid = sUserID; string sTranTime = TransGBLL.TransTimeSelByTID(sOrderID); string orderId = ProvideCommon.getTime(DateTime.Parse(sTranTime)).ToString(); int iGold = Convert.ToInt32(dMoney * 10); string gold = iGold.ToString(); string tp = ProvideCommon.getTime().ToString(); string payKey = "##$~@@(dao50::PAY)@@RMd3YAtihg5GhO6LsU"; StringBuilder sbText = new StringBuilder(); sbText.Append(yx); sbText.Append(userid); sbText.Append(orderId); sbText.Append(gold); sbText.Append(tp); sbText.Append(payKey); string ticket = ProvideCommon.MD5(sbText.ToString());//yx+userId+orderId+gold+tp+payKey string sGamePayUrl = string.Format("http://{0}/yx/pay?yx={1}&userId={2}&playerId={3}&orderId={4}&gold={5}&tp={6}&ticket={7}", ServerHost(sGame), yx, userid, playerId, orderId, gold, tp, ticket); string sRes = ProvideCommon.GetPageInfo(sGamePayUrl); string sTranIP = ProvideCommon.GetRealIP(); int iUserID = 0; int.TryParse(sUserID, out iUserID); GamePayBLL.GamePayAdd(sTranIP, sGamePayUrl, sOrderID, sRes, sGame, iUserID); return(sRes); }
public static string Pay(string sUserID, int iMoney, string sOrderID, string sGame) { string key = "f06b9a55978836e041d174a616ebba25"; string unionCode = "unionhysjdaowulin"; string sTranTime = TransGBLL.TransTimeSelByTID(sOrderID); string orderId = ProvideCommon.getTime(DateTime.Parse(sTranTime)).ToString(); string userName = HttpUtility.UrlEncode(sUserID); string chargeTime = DateTime.Now.ToString("yyyyMMddHHmmss"); string chargeMoney = iMoney.ToString("f2"); int iGamePoints = iMoney * 10; string chargeAmount = iGamePoints.ToString(); string Gatewayid = GetPaySeverID(sGame); string Gameid = "820"; string clientIp = ProvideCommon.GetRealIP(); StringBuilder sbText = new StringBuilder(); sbText.Append(unionCode); sbText.Append(orderId); sbText.Append(userName); sbText.Append(chargeTime); sbText.Append(chargeMoney); sbText.Append(chargeAmount); sbText.Append(Gatewayid); sbText.Append(Gameid); sbText.Append(key); string sign = ProvideCommon.MD5(sbText.ToString());//小写英文字母与数字组合,md5(unionCode+orderId+userName+chargeTime+chargeMoney+chargeAmount+gatewayId+gameId+key)注意:chargeMoney 参与md5 计算时应保留小数点两位,例如35 应该转换为35.00。key 由蓝港在线生成,告知联运方。 sbText.Remove(0, sbText.Length); string serverdomain = GetDomain(sGame); string TranURL = "http://59.151.39.189:8080/union_mid/charging.do"; sbText.Append(TranURL); sbText.AppendFormat("?unionCode={0}&", unionCode); sbText.AppendFormat("orderId={0}&", orderId); sbText.AppendFormat("userName={0}&", userName); sbText.AppendFormat("chargeTime={0}&", chargeTime); sbText.AppendFormat("chargeMoney={0}&", chargeMoney); sbText.AppendFormat("chargeAmount={0}&", chargeAmount); sbText.AppendFormat("gatewayId={0}&", Gatewayid); sbText.AppendFormat("gameId={0}&", Gameid); sbText.AppendFormat("clientIp={0}&", clientIp); sbText.AppendFormat("sign={0}", sign); string sRes = ProvideCommon.GetPageInfo(sbText.ToString()); int iUserID = 0; int.TryParse(sUserID, out iUserID); string user_ip = ProvideCommon.GetRealIP(); GamePayBLL.GamePayAdd(user_ip, sbText.ToString(), sOrderID, sRes, sGame, iUserID); return(sRes); }