/// <summary> /// a8充值(1) /// </summary> /// <returns></returns> private string Charge() { try { /*${payNotifyURL}?sign=96d740ea416b8bf118ead1c49c9a1eda&goodsId=105&price=29&game * OrderId=8a71d1a4-fc36-4487-9577-0b3a3b848b65&payResult=0&playerId=h5_a89e3df51e43f8 * 4002b843ecd16fd59617&channelAlias=h5_a8&state=&serverId=default&payTime=1449475293 * 422&orderId=1751615 * 返回值:{"ret":"success","msg":"ok"}*/ string sign = GetParam("sign"); string orderId = GetParam("orderId"); string gameOrderId = GetParam("gameOrderId"); string price = GetParam("price"); string channelAlias = GetParam("channelAlias"); string playerId = GetParam("playerId"); string serverId = GetParam("serverId"); string goodsId = GetParam("goodsId"); string payResult = GetParam("payResult"); string state = GetParam("state"); string payTime = GetParam("payTime"); if (string.IsNullOrEmpty(sign) || string.IsNullOrEmpty(orderId) || string.IsNullOrEmpty(gameOrderId) || string.IsNullOrEmpty(price) || string.IsNullOrEmpty(channelAlias) || string.IsNullOrEmpty(playerId) || string.IsNullOrEmpty(serverId) || string.IsNullOrEmpty(goodsId) || string.IsNullOrEmpty(payResult) || string.IsNullOrEmpty(sign) || string.IsNullOrEmpty(payTime) ) { return("{\"ret\":\"fail\",\"msg\":\"参数为空\"}"); } if (int.Parse(payResult) == 0) { return("{\"ret\":\"fail\",\"msg\":\"没有付款成功\"}"); } //Sign = Md5(orderId + gameOrderId + price + channelAlias + playerId+ serverId + goodsId + payResult + state + payTime + PayKey).toLowerCase(); long time1 = ConvertHelper.ConvertToLong(payTime, 0); DateTime sourceTime = ShareUtil.GetTime(time1); DateTime nowTime = DateTime.Now; //检查时间是否过期 if (sourceTime.AddSeconds(UAFactory.Instance.Timeout30min) < nowTime || sourceTime.AddSeconds(-UAFactory.Instance.Timeout30min) > nowTime) { //记录详细的错误日志 return("{\"ret\":\"fail\",\"msg\":\"响应超时\"}"); } var channelAliasEntity = UAFactory.Instance.GetPlatform(platFormKey); if (channelAliasEntity == null) { return("{\"ret\":\"fail\",\"msg\":\"channelAlias错误\"}"); } string cryptKey = channelAliasEntity.ChargeKey; string signParam = CryptHelper.GetMD5(orderId + gameOrderId + price + channelAlias + playerId + serverId + goodsId + payResult + state + payTime + cryptKey).ToLower(); if (sign != signParam) { return("{\"ret\":\"fail\",\"msg\":\"sign错误\"}"); } decimal cash = ConvertHelper.ConvertToDecimal(price, 0) / 100; //a8价格单位是 分 Guid managerId = Guid.Empty; try { managerId = new Guid(playerId); } catch { return("{\"ret\":\"fail\",\"msg\":\"未找到角色\"}"); } var result = WebServerHandler.BuyPointShipments(platFormKey, "" + serverId, playerId, gameOrderId, orderId, cash, ConvertHelper.ConvertToInt(goodsId)); if (result == 0) { return("{\"ret\":\"success\",\"msg\":\"ok\"}"); } switch (result) { case 2062: return("{\"ret\":\"fail\",\"msg\":\"未找到角色\"}"); case 5211: return("{\"ret\":\"fail\",\"msg\":\"未找到订单\"}"); case 151: return("{\"ret\":\"fail\",\"msg\":\"物品ID错误\"}"); default: return("{\"ret\":\"fail\",\"msg\":\"系统内部错误\"}"); } } catch (Exception ex) { SystemlogMgr.Error("a8 dologinnew", ex); return("{\"ret\":\"fail\",\"msg\":\"系统内部错误2\"}"); } }
/// <summary> /// egret充值(1) /// </summary> /// <returns></returns> private string Charge() { try { string sign = GetParam("sign"); string billingId = GetParam("orderId"); string price = GetParam("money"); string playerId = GetParam("id"); string serverId = GetParam("serverId"); string goodsId = GetParam("goodsId"); string orderId = GetParam("ext"); string payTime = GetParam("time"); string goodsNumber = GetParam("goodsNumber"); if (string.IsNullOrEmpty(sign) || string.IsNullOrEmpty(orderId) || string.IsNullOrEmpty(price) || string.IsNullOrEmpty(playerId) || string.IsNullOrEmpty(serverId) || string.IsNullOrEmpty(goodsId) || string.IsNullOrEmpty(sign) || string.IsNullOrEmpty(payTime) || string.IsNullOrEmpty(billingId) ) { return("{\"code\":-1,\"msg\":\"参数为空\"}"); } //var strs = orderId.Split('|'); //var zone = ""; //if (strs.Count() >= 2) // zone = strs[0]; long time1 = ConvertHelper.ConvertToLong(payTime, 0); DateTime sourceTime = ShareUtil.GetTime(time1 * 1000); DateTime nowTime = DateTime.Now; //检查时间是否过期 if (sourceTime.AddSeconds(UAFactory.Instance.Timeout30min) < nowTime || sourceTime.AddSeconds(-UAFactory.Instance.Timeout30min) > nowTime) { //记录详细的错误日志 return("{\"code\":-1,\"msg\":\"响应超时\"}"); } var platFormentity = UAFactory.Instance.GetPlatform(platFormKey); if (platFormentity == null) { return("{\"code\":-1,\"msg\":\"platFormentity错误\"}"); } string cryptKey = platFormentity.ChargeKey; string signParam = CryptHelper.GetMD5(string.Format(@"ext={0}goodsId={1}goodsNumber={2}id={3}money={4}orderId={5}serverId={6}time={7}{8}", orderId, goodsId, goodsNumber, playerId, price, billingId, serverId, payTime, cryptKey)); if (sign != signParam) { return("{\"code\":-1,\"msg\":\"sign错误\"}"); } decimal cash = ConvertHelper.ConvertToDecimal(price, 0); //egret价格单位是 元 //var zone = ""; //if (serverId == "1002") // zone = "bls2"; //else //{ // zone = "bls1"; //} //var list = NbManagerMgr.GetByAccount(playerId,zone); //if(list==null) // return "{\"code\":-1,\"msg\":\"未找到角色\"}"; //var manager = list[0]; var result = 0; try { result = WebServerHandler.BuyPointShipments(platFormKey, "" + serverId, "" + playerId, orderId, billingId, cash, ConvertHelper.ConvertToInt(goodsId));//白鹭传account } catch (Exception) { } if (result == 0) { return("{\"code\":0,\"msg\":\"ok\"}"); } switch (result) { case 2062: return("{\"code\":-1,\"msg\":\"未找到角色\"}"); case 5211: return("{\"code\":-1,\"msg\":\"未找到订单\"}"); case 151: return("{\"code\":-1,\"msg\":\"物品ID错误\"}"); default: return("{\"code\":-1,\"msg\":\"系统内部错误\"" + result + "}"); } } catch (Exception ex) { SystemlogMgr.Error("h5_egret Charge", ex); return("{\"code\":-1,\"msg\":\"系统内部错误2\"}"); } }
/// <summary> /// pay回调 /// </summary> /// <returns></returns> private string Charge() { try { /*${payNotifyURL}?sign=96d740ea416b8bf118ead1c49c9a1eda&goodsId=105&price=29&game * OrderId=8a71d1a4-fc36-4487-9577-0b3a3b848b65&payResult=0&playerId=h5_a89e3df51e43f8 * 4002b843ecd16fd59617&channelAlias=h5_a8&state=&serverId=default&payTime=1449475293 * 422&orderId=1751615 * 返回值:{"ret":"success","msg":"ok"}*/ string sign = GetParam("sign"); string nonce_str = GetParam("nonce_str"); string extra = GetParam("extra"); string isTest = GetParam("isTest"); string appId = GetParam("appId"); string product_id = GetParam("product_id"); string order_id = GetParam("order_id"); string transaction_id = GetParam("transaction_id"); string price = GetParam("cash"); string uid = GetParam("uid"); string game_uid = GetParam("game_uid"); string payResult = GetParam("result"); //UAHelper.WriteLog("bear Charge", // string.Format( // @"appId={0}&cash={1}&extra={2}&game_uid={3}&isTest={4}&nonce_str={5}&order_id={6}&product_id={7}&result={8}&transaction_id={9}&uid={10}||{11}" // , appId, price, extra, game_uid, isTest, nonce_str, order_id, product_id, payResult, transaction_id, uid, // sign)); if (string.IsNullOrEmpty(sign) || string.IsNullOrEmpty(nonce_str) || string.IsNullOrEmpty(extra) || string.IsNullOrEmpty(payResult) || string.IsNullOrEmpty(game_uid) || string.IsNullOrEmpty(transaction_id) || string.IsNullOrEmpty(price) || string.IsNullOrEmpty(sign) || string.IsNullOrEmpty(uid) ) { return("{\"ret\":\"fail\",\"msg\":\"参数为空\"}"); } if (payResult.Trim().ToLower() != "success") { return("{\"ret\":\"fail\",\"msg\":\"没有付款成功\"}"); } var channelAliasEntity = UAFactory.Instance.GetPlatform(platFormKey); if (channelAliasEntity == null) { return("{\"ret\":\"fail\",\"msg\":\"channelAlias错误\"}"); } string cryptKey = channelAliasEntity.ChargeKey; string signParam = CryptHelper.GetMD5(string.Format(@"appId={0}&cash={1}&extra={2}&game_uid={3}&isTest={4}&nonce_str={5}&order_id={6}&product_id={7}&result={8}&transaction_id={9}&uid={10}{11}" , appId, price, extra, game_uid, isTest, nonce_str, order_id, product_id, payResult, transaction_id, uid, cryptKey)); if (sign != signParam) { return("{\"ret\":\"fail\",\"msg\":\"sign错误\"}"); } var ary = extra.Split('|'); var server = ""; var orderId = ""; if (ary.Length > 1) { orderId = ary[0]; server = ary[1]; } decimal cash = ConvertHelper.ConvertToDecimal(price, 0) / 100; //价格单位是 分 var zoneName = ShareUtil.ZoneName; var list = NbManagerMgr.GetByAccount(uid, zoneName); var manager = new NbManagerEntity(); if (list.Count > 0) { manager = list[0]; } var result = WebServerHandler.BuyPointShipments(platFormKey, server, "" + manager.Idx, orderId, order_id, cash, ConvertHelper.ConvertToInt(product_id)); if (result == 0) { return("OK"); } switch (result) { case 2062: return("{\"ret\":\"fail\",\"msg\":\"未找到角色\"}"); case 5211: return("{\"ret\":\"fail\",\"msg\":\"未找到订单\"}"); case 151: return("{\"ret\":\"fail\",\"msg\":\"物品ID错误\"}"); default: return("{\"ret\":\"fail\",\"msg\":\"系统内部错误\"}"); } } catch (Exception ex) { SystemlogMgr.Error("bear Charge", ex); return("{\"ret\":\"fail\",\"msg\":\"系统内部错误2\"}"); } }
private string Charge() { try { string serverid = GetParam("serverid"); string orderno = GetParam("orderno"); string username = GetParam("username"); string addgold = GetParam("addgold"); string rmb = GetParam("rmb"); string paytime = GetParam("paytime"); string ext = GetParam("ext"); string sign = GetParam("sign"); if (string.IsNullOrEmpty(sign) || string.IsNullOrEmpty(serverid) || string.IsNullOrEmpty(orderno) || string.IsNullOrEmpty(username) || string.IsNullOrEmpty(addgold) || string.IsNullOrEmpty(rmb) || string.IsNullOrEmpty(paytime) || string.IsNullOrEmpty(ext) || string.IsNullOrEmpty(sign)) { return("-4"); } //Sign = Md5(orderno+username + serverid+addgold + rmb+paytime+ext+key).toLowerCase(); //long time1 = ConvertHelper.ConvertToLong(paytime, 0); //DateTime sourceTime = ShareUtil.GetTime(time1); //DateTime nowTime = DateTime.Now; ////检查时间是否过期 //if (sourceTime.AddSeconds(UAFactory.Instance.Timeout30min) < nowTime || // sourceTime.AddSeconds(-UAFactory.Instance.Timeout30min) > nowTime) //{ // //记录详细的错误日志 // return "{\"ret\":\"fail\",\"msg\":\"响应超时\"}"; //} var channelAliasEntity = UAFactory.Instance.GetPlatform(platFormKey); if (channelAliasEntity == null) { return("-4"); } string cryptKey = channelAliasEntity.ChargeKey; string signParam = CryptHelper.GetMD5(orderno + username + serverid + addgold + rmb + paytime + ext + cryptKey).ToLower(); if (sign != signParam) { return("-4"); } decimal cash = ConvertHelper.ConvertToDecimal(rmb, 0); var exts = ext.Split('_'); if (exts.Length < 3) { return("-4"); } int mallCode = ConvertHelper.ConvertToInt(exts[0]); string sId = exts[1]; string orderId = exts[2]; var result = WebServerHandler.BuyPointShipments(platFormKey, sId, username, orderId, orderno, cash, mallCode); if (result == 0) { return("1"); } SystemlogMgr.Error("充值", "code:" + result); switch (result) { case 2062: return("-2"); case 5211: return("-1"); case 151: return("-1"); default: return("-7"); } } catch (Exception ex) { SystemlogMgr.Error("a8 dologinnew", ex); return("-7"); } }