/// <summary> /// 天行剑充值接口 /// </summary> /// <param name="OrderNo">订单号</param> /// <returns>返回支付结果</returns> public string Pay(string OrderNo) { order = os.GetOrder(OrderNo); //获取用户的充值订单 gu = gus.GetGameUser(order.UserName); //获取充值用户 gs = gss.GetGameServer(order.ServerId); //获取用户要充值的服务器 string PayGold = (order.PayMoney * game.GameMoneyScale).ToString(); //计算支付的游戏币 if (gus.IsGameUser(gu.UserName)) //判断用户是否属于平台 { tstamp = Utils.GetTimeSpan(); //获取时间戳 Sign = DESEncrypt.Md5(OrderNo + gu.UserName + PayGold + order.PayMoney + tstamp + gc.PayTicket, 32); string PayUrl = "http://" + gs.ServerNo + "." + gc.PayCom + "?orderid=" + OrderNo + "&username="******"&gold=" + PayGold + "&money=" + order.PayMoney + "&time=" + tstamp + "&flag=" + Sign + "&channel="; GameUserInfo gui = Sel(gu.Id, gs.Id); //获取玩家查询信息 if (gui.Message == "Success") //判断玩家是否存在 { if (order.State == 1) //判断订单状态是否为支付状态 { string PayResult = Utils.GetWebPageContent(PayUrl); //获取充值结果 switch (PayResult) //对充值结果进行解析 { case "1": if (os.UpdateOrder(order.OrderNo)) //更新订单状态为已完成 { gus.UpdateGameMoney(gu.UserName, order.PayMoney); //跟新玩家游戏消费情况 return "充值成功!"; } else { return "充值成功!错误原因:更新订单状态失败!"; } case "2": return "充值失败!无法提交重复订单!"; case "-1": return "充值失败!参数不全!"; case "-2": return "充值失败!验证失败!"; case "-3": return "充值失败!用户不存在!"; case "-4": return "充值失败!请求超时!"; case "-5": return "充值失败!充值比例异常!"; default: return "充值失败!未知错误!"; } } else { return "充值失败!错误原因:无法提交未支付订单!"; } } else { return gui.Message; } } else { return "充值失败!用户不存在!"; } }
/// <summary> /// 封天传充值接口 /// </summary> /// <param name="OrderNo">订单号</param> /// <returns>返回充值结果</returns> public string Pay(string OrderNo) { order = os.GetOrder(OrderNo); //获取用户的充值订单 gu = gus.GetGameUser(order.UserName); //获取充值用户 gs = gss.GetGameServer(order.ServerId); //获取用户要充值的服务器 string PayGold = (order.PayMoney * game.GameMoneyScale).ToString(); //计算支付的游戏币 if (gus.IsGameUser(gu.UserName)) //判断用户是否属于平台 { tstamp = Utils.GetTimeSpan(); //获取时间戳 Sign = DESEncrypt.Md5("[" + gc.PayTicket + gu.UserName + "1" + order.PayMoney + tstamp + "]", 32); string PayUrl = "http://" + gs.ServerNo + "." + gc.PayCom + "?userName="******"&goodsId=1&num=" + order.PayMoney + "&time=" + tstamp + "&sign=" + Sign + "&orderId=" + OrderNo + "&source=tt&serverId=" + gs.ServerNo; GameUserInfo gui = Sel(gu.Id, gs.Id); //获取玩家查询信息 if (gui.Message == "Success") //判断玩家是否存在 { if (order.State == 1) //判断订单状态是否为支付状态 { try { string PayResult = Utils.GetWebPageContent(PayUrl); //获取充值结果 switch (PayResult) { case "1": if (os.UpdateOrder(order.OrderNo)) //更新订单状态为已完成 { gus.UpdateGameMoney(gu.UserName, order.PayMoney); //跟新玩家游戏消费情况 return "充值成功!"; } else { return "充值失败!错误原因:更新订单状态失败!"; } case "0": return "充值失败!错误原因:充值失败!"; case "2": return "充值失败!错误原因:无法提交重复订单!"; default: return "充值失败!未知错误!"; } } catch (Exception) { return "充值失败!错误原因:充值失败!"; } } else { return "充值失败!错误原因:无法提交未支付订单!"; } } else { return gui.Message; } } else { return "充值失败!错误原因:用户不存在"; } }
/// <summary> /// 一剑轩辕充值接口 /// </summary> /// <param name="OrderNo">订单号</param> /// <returns>返回充值结果</returns> public string Pay(string OrderNo) { order = os.GetOrder(OrderNo); //获取用户的充值订单 gu = gus.GetGameUser(order.UserName); //获取充值用户 gs = gss.GetGameServer(order.ServerId); //获取用户要充值的服务器 string PayGold = (order.PayMoney * game.GameMoneyScale).ToString(); //计算支付的游戏币 if (gus.IsGameUser(gu.UserName)) //判断用户是否属于平台 { tstamp = Utils.GetTimeSpan(); //获取时间戳 Sign = DESEncrypt.Md5(gu.UserName + "|" + tstamp + "|" + PayGold + "|" + gs.QuFu + "|" + gc.PayTicket, 32); string PayUrl = "http://" + gs.ServerNo + "." + gc.PayCom + "?accname=" + gu.UserName + "&paytime=" + tstamp + "&gold=" + PayGold + "&billno=" + OrderNo + "&serverid=" + gs.QuFu + "&sign=" + Sign; GameUserInfo gui = Sel(gu.Id, gs.Id); //获取玩家查询信息 if (gui.Message == "Success") //判断玩家是否存在 { if (order.State == 1) //判断订单状态是否为支付状态 { string PayResult = Utils.GetWebPageContent(PayUrl); //获取充值结果 Dictionary<string, string> PRE = Json.JsonToArray(PayResult); switch (PRE["ret"]) //对充值结果进行解析 { case "0": if (os.UpdateOrder(order.OrderNo)) //更新订单状态为已完成 { gus.UpdateGameMoney(gu.UserName, order.PayMoney); //跟新玩家游戏消费情况 return "充值成功!"; } else { return "充值失败!错误原因:更新订单状态失败!"; } case "1": return "充值失败!错误原因:角色不存在!"; case "2": return "充值失败!错误原因:无法提交重复订单!"; case "3": return "充值失败!错误原因:验证失败!"; case "4": return "充值失败!错误原因:参数错误!"; case "5": return "充值失败!错误原因:非法Ip!"; default: return "充值失败!未知错误!"; } } else { return "充值失败!错误原因:无法提交未支付订单!"; } } else { return "充值失败!角色不存在!"; } } else { return "充值失败!用户不存在!"; } }
/// <summary> /// 冒险契约登陆接口 /// </summary> /// <param name="UserId">用户Id</param> /// <param name="ServerId">服务器Id</param> /// <param name="IsPc">是否PC端登陆</param> /// <returns>返回登陆地址</returns> public string Login(int UserId, int ServerId, int IsPc) { gu = gus.GetGameUser(UserId); //获取当前登录用户 gs = gss.GetGameServer(ServerId); //获取用户要登录的服务器 tstamp = Utils.GetTimeSpan(); //获取时间戳 Sign = DESEncrypt.Md5(gu.UserName + tstamp + gc.LoginTicket + "1", 32); //获取验证码 string LoginUrl = "http://" + gs.ServerNo + "." + gc.LoginCom + "?username="******"&serverid=" + 1 + "&time=" + tstamp + "&cm=1&flag=" + Sign; return LoginUrl; }
/// <summary> /// 绝代双骄登陆接口 /// </summary> /// <param name="UserId">用户Id</param> /// <param name="ServerId">服务器Id</param> /// <param name="IsPC">是否PC端登陆</param> /// <returns>返回登陆地址</returns> public string Login(int UserId, int ServerId, int IsPC) { gu = gus.GetGameUser(UserId); //获取要登录用户 gs = gss.GetGameServer(ServerId); //获取要登录的服务器 tstamp = DateTime.Now.ToString("yyyyMMddHHmmss"); //获取时间戳 Sign = DESEncrypt.Md5("uid=" + gu.Id + "&uname=" + gu.UserName + "&lgtime=" + tstamp + "&uip=" + BBRequest.GetIP().Replace(".", "_") + "&type=" + gc.AgentId + "&sid=" + gs.ServerNo + "&key=" + gc.LoginTicket, 32); string LoginUrl = "http://" + gc.LoginCom + "?uid=" + gu.Id + "&uname=" + gu.UserName + "&lgtime=" + tstamp + "&uip=" + BBRequest.GetIP().Replace(".", "_") + "&type=" + gc.AgentId + "&sid=" + gs.ServerNo + "&sign=" + Sign; return LoginUrl; }
/// <summary> /// 最无极登陆接口 /// </summary> /// <param name="UserId">用户Id</param> /// <param name="ServerId">服务器Id</param> /// <param name="IsPC">是否客户端登陆</param> /// <returns>返回登陆地址</returns> public string Login(int UserId, int ServerId, int IsPC) { gu = gus.GetGameUser(UserId); //获取当前登录用户 gs = gss.GetGameServer(ServerId); //获取用户要登录的服务器 tstamp = Utils.GetTimeSpan(); //获取时间戳 Sign = DESEncrypt.Md5(gu.Id + gu.UserName + gs.QuFu + "1" + tstamp + gc.LoginTicket, 32); //获取验证码 string LoginUrl = "http://" + gs.ServerNo + "." + gc.LoginCom + "?user_id=" + gu.Id + "&user_name=" + gu.UserName + "&time=" + tstamp + "&is_adult=1&sign=" + Sign + "&server_id=" + gs.QuFu; return LoginUrl; }
/// <summary> /// 可乐三国登陆接口 /// </summary> /// <param name="UserId">用户Id</param> /// <param name="ServerId">服务器Id</param> /// <param name="IsPC">是否PC端登陆</param> /// <returns>返回登陆地址</returns> public string Login(int UserId, int ServerId, int IsPC) { gu = gus.GetGameUser(UserId); //获取当前登录用户 gs = gss.GetGameServer(ServerId); //获取用户要登录的服务器 tstamp = Utils.GetTimeSpan(); //获取时间戳 Sign = DESEncrypt.Md5("cardId=1&cardName=1&cm=1&name=myname&platId=" + gc.AgentId + "&platUid=" + gu.UserName + "&sid=" + gs.ServerNo + "&srcId=" + gc.AgentId + "&tm=" + tstamp + "&" + gc.LoginTicket, 32); //获取验证参数 string LoginUrl = "http://" + gc.LoginCom + "?cardId=1&cardName=1&cm=1&name=myname&platId=" + gc.AgentId + "&platUid=" + gu.UserName + "&sid=" + gs.ServerNo + "&srcId=" + gc.AgentId + "&tm=" + tstamp + "&sig=" + Sign; //生成登录地址 return LoginUrl; }
/// <summary> /// 怒斩登录接口 /// </summary> /// <param name="UserId">用户Id</param> /// <param name="ServerId">服务器Id</param> /// <returns>返回登录地址</returns> public string Login(int UserId, int ServerId, int IsPC) { gu = gus.GetGameUser(UserId); //获取当前登录用户 gs = gss.GetGameServer(ServerId); //获取用户要登录的服务器 tstamp = Utils.GetTimeSpan(); //获取时间戳 string sign = DESEncrypt.Md5(gu.Id + gu.UserName + tstamp + "1" + gc.LoginTicket, 32); string LoginUrl = "http://" + gs.ServerNo + "." + gc.LoginCom + "login.php?u=" + UserId + "&n=" + gu.UserName + "&t=" + tstamp + "&cm=1&p=" + sign + "&type=ie&s=" + gs.ServerNo; return LoginUrl; }
/// <summary> /// 楚汉传奇登陆接口 /// </summary> /// <param name="UserId">用户Id</param> /// <param name="ServerId">服务器Id</param> /// <param name="IsPC">是否PC端登陆</param> /// <returns>返回登陆地址</returns> public string Login(int UserId, int ServerId, int IsPc) { gu = gus.GetGameUser(UserId); //获取当前登录用户 gs = gss.GetGameServer(ServerId); //获取用户要登录的服务器 tstamp = Utils.GetTimeSpan(); //获取时间戳 Sign = DESEncrypt.Md5("from=" + gc.AgentId + "game=chuhan" + "server=" + gs.ServerNo + "user_id=" + gu.UserName + "fatigue=2" + "t=" + tstamp + "login_secret_signature=" + gc.LoginTicket, 32); //获取验证码 string LoginUrl = "http://" + gc.LoginCom + "?from=" + gc.AgentId + "&game=chuhan&server=" + gs.ServerNo + "&user_id=" + gu.UserName + "&fatigue=2&t=" + tstamp + "&signature=" + Sign; return LoginUrl; }
/// <summary> /// 仙侠傲世登陆接口 /// </summary> /// <param name="UserId">用户Id</param> /// <param name="ServerId">服务器Id</param> /// <param name="IsPC">是否客户端</param> /// <returns>返回登陆地址</returns> public string Login(int UserId, int ServerId, int IsPC) { gu = gus.GetGameUser(UserId); //获取当前登录用户 gs = gss.GetGameServer(ServerId); //获取用户要登录的服务器 tstamp = Utils.GetTimeSpan(); //获取时间戳 Sign = DESEncrypt.Md5(gu.UserName + tstamp + "0" + DESEncrypt.Md5(gc.LoginTicket, 32), 32);//获取验证码 string LoginUrl = "http://" + gs.ServerNo + "." + gc.LoginCom + "/api/login.php?account=" + gu.UserName + "&time=" + tstamp + "&flag=" + Sign + "&fcm=0&server_id=" + gs.ServerNo; return LoginUrl; }
/// <summary> /// 街机三国登录接口 /// </summary> /// <param name="UserId">用户Id</param> /// <param name="ServerId">服务器Id</param> /// <param name="IsPC">是否PC端登陆</param> /// <returns>返回登陆地址</returns> public string Login(int UserId, int ServerId, int IsPC) { gu = gus.GetGameUser(UserId); //获取当前登录用户 gs = gss.GetGameServer(ServerId); //获取用户要登录的服务器 tstamp = Utils.GetTimeSpan(); //获取时间戳 Sign = DESEncrypt.Md5(gu.Id + gc.AgentId + tstamp + gs.ServerNo + gc.LoginTicket, 32); string LoginUrl = "http://" + gc.LoginCom + "?user="******"&time=" + tstamp + "&server_id=" + gs.ServerNo + "&platform=" + gc.AgentId + "&sign=" + Sign + "&non_kid=1&source=®date=&backurl="; return LoginUrl; }
string tstamp; //定义时间戳 #endregion Fields #region Methods /// <summary> /// 奇迹来了登陆接口 /// </summary> /// <param name="UserId">用户Id</param> /// <param name="ServerId">服务器Id</param> /// <param name="IsPC">是否PC端登陆</param> /// <returns>返回登陆地址</returns> public string Login(int UserId, int ServerId, int IsPC) { gu = gus.GetGameUser(UserId); //获取当前登录用户 gs = gss.GetGameServer(ServerId); //获取用户要登录的服务器 tstamp = Utils.GetTimeSpan(); Sign = DESEncrypt.Md5("name=" + gu.UserName + "&platid=" + gc.AgentId + "&platuid=" + gu.Id + "&sid=" + gs.Id + "&tm=" + tstamp + gc.LoginTicket, 32); //获取验证参数 string LoginUrl = "http://" + gs.ServerNo + "." + gc.LoginCom + "?name=" + gu.UserName + "&platid=" + gc.AgentId + "&platuid=" + gu.Id + "&sid=" + gs.Id + "&tm=" + tstamp + "&sig=" + Sign; //生成登录地址 return LoginUrl; }
/// <summary> /// 斗破乾坤登录接口 /// </summary> /// <param name="UserId">用户Id</param> /// <param name="ServerId">服务器Id</param> /// <param name="IsPC">是否PC端登陆</param> /// <returns>返回登录地址</returns> public string Login(int UserId, int ServerId, int IsPC) { gu = gus.GetGameUser(UserId); //获取当前登录用户 gs = gss.GetGameServer(ServerId); //获取用户要登录的服务器 tstamp = Utils.GetTimeSpan(); //获取时间戳 Sign = DESEncrypt.Md5("account=" + gu.UserName + "&agent=" + gc.AgentId + "&fcm=1&fcm_time=-1&serverid=" + gs.ServerNo + "&time=" + tstamp + "&way=1&" + gc.LoginTicket, 32); string LoginUrl = "http://" + gs.ServerNo + "." + gc.LoginCom + "?account=" + gu.UserName + "&agent=" + gc.AgentId + "&fcm=1&fcm_time=-1&serverid=" + gs.ServerNo + "&time=" + tstamp + "&way=1&token=" + Sign; return LoginUrl; }
/// <summary> /// 太古遮天登陆接口 /// </summary> /// <param name="UserId">用户Id</param> /// <param name="ServerId">服务器Id</param> /// <param name="IsPC">是否客户端</param> /// <returns>返回登陆地址</returns> public string Login(int UserId, int ServerId, int IsPC) { gu = gus.GetGameUser(UserId); //获取当前登录用户 gs = gss.GetGameServer(ServerId); //获取用户要登录的服务器 tstamp = Utils.GetTimeSpan(); //获取时间戳 Sign = DESEncrypt.Md5(gc.LoginTicket + gu.UserName + tstamp + gc.AgentId + gs.QuFu + "1", 32); //获取验证码 string LoginUrl = "http://" + gc.LoginCom + "/api/v1/mc/start.php?accountName=" + gu.UserName + "&stamp=" + tstamp + "&agentName=" + gc.AgentId + "&serverID=" + gs.QuFu + "&fcm=1&flag=" + Sign; return LoginUrl; }
/// <summary> /// 热血海贼王登录接口 /// </summary> /// <param name="UserId">用户Id</param> /// <param name="ServerId">服务器Id</param> /// <param name="IsPC">是否PC端登陆</param> /// <returns>返回登陆地址</returns> public string Login(int UserId, int ServerId, int IsPC) { gu = gus.GetGameUser(UserId); //获取要登录用户 gs = gss.GetGameServer(ServerId); //获取要登录的服务器 tstamp = Utils.GetTimeSpan(); //获取时间戳 Sign = DESEncrypt.Md5("qid=" + gu.Id + "&time=" + tstamp + "&server_id=" + gs.ServerNo + gc.LoginTicket, 32); //获取验证参数 string LoginUrl = "http://" + gs.ServerNo + "." + gc.LoginCom + "?qid=" + gu.Id + "&time=" + tstamp + "&server_id=" + gs.ServerNo + "&sign=" + Sign + "&isAdult=1"; return LoginUrl; }
/// <summary> /// 封天传登陆接口 /// </summary> /// <param name="UserId">用户Id</param> /// <param name="ServerId">服务器Id</param> /// <param name="IsPC">是否PC端登陆</param> /// <returns>返回登陆地址</returns> public string Login(int UserId, int ServerId, int IsPC) { gu = gus.GetGameUser(UserId); //获取当前登录用户 gs = gss.GetGameServer(ServerId); //获取用户要登录的服务器 tstamp = Utils.GetTimeSpan(); //获取时间戳 Sign = DESEncrypt.Md5("{" + gu.UserName + gc.LoginTicket + tstamp + "}", 32); //获取验证码 string LoginUrl = "http://" + gs.ServerNo + "." + gc.LoginCom + "?userName="******"&time=" + tstamp + "&sign=" + Sign + "&source=tt&serverId=" + gs.ServerNo; return LoginUrl; }
/// <summary> /// 烈焰登陆接口 /// </summary> /// <param name="UserId">用户Id</param> /// <param name="ServerId">服务器Id</param> /// <param name="IsPC">是否PC端登陆</param> /// <returns>返回登陆地址</returns> public string Login(int UserId, int ServerId, int IsPC) { gu = gus.GetGameUser(UserId); //获取当前登录用户 gs = gss.GetGameServer(ServerId); //获取用户要登录的服务器 tstamp = Utils.GetTimeSpan(); //获取时间戳 Sign = DESEncrypt.Md5("id=" + gu.UserName + "&now=" + tstamp + "." + gc.LoginTicket, 32); //获取验证码 string LoginUrl = "http://" + gs.ServerNo + "." + gc.LoginCom + "?id=" + gu.UserName + "&time=" + tstamp + "&isAdult=1&is_client=" + IsPC + "&sign=" + Sign; return LoginUrl; }
/// <summary> /// 枪魂登录接口 /// </summary> /// <param name="UserId">用户Id</param> /// <param name="ServerId">服务器Id</param> /// <param name="IsPC">是否PC端</param> /// <returns>返回登录地址</returns> public string Login(int UserId, int ServerId, int IsPC) { gu = gus.GetGameUser(UserId); //获取当前登录用户 gs = gss.GetGameServer(ServerId); //获取用户要登录的服务器 tstamp = Utils.GetTimeSpan(); Sign = DESEncrypt.Md5(gu.UserName + tstamp + gc.LoginTicket + gs.QuFu, 32); //获取验证参数 string LoginUrl = "http://" + gs.ServerNo + "." + gc.LoginCom + "?username="******"&time=" + tstamp + "&flag=" + Sign + "&serverid=" + gs.QuFu + ""; //生成登录地址 return LoginUrl; }
/// <summary> /// 大清英雄传登陆接口 /// </summary> /// <param name="UserId">用户Id</param> /// <param name="ServerId">服务器Id</param> /// <param name="IsPC">是否客户端登陆</param> /// <returns>返回登陆地址</returns> public string Login(int UserId, int ServerId, int IsPC) { gu = gus.GetGameUser(UserId); //获取当前登录用户 gs = gss.GetGameServer(ServerId); //获取用户要登录的服务器 tstamp = Utils.GetTimeSpan(); Sign = DESEncrypt.Md5(gu.UserName + gc.AgentId + "1" + gs.ServerNo + "1" + tstamp + gc.LoginTicket, 32);//获取验证参数 string LoginUrl = "http://" + gc.LoginCom + "?sid=" + gc.AgentId + "&gid=" + "GameId" + "&servid=" + gs.ServerNo + "&username="******"&isAdult=1&time=" + tstamp + "&MD5=" + Sign; //生成登录地址 return LoginUrl; }
public string DoLogin() { string UserName = Request["UserName"].Trim(); string PWD = Request["PWD"].Trim(); string Code = Request["Code"].Trim(); if (string.IsNullOrEmpty(UserName)) { return "请输入用户名!"; } if (string.IsNullOrEmpty(PWD)) { return "请输入密码!"; } if (string.IsNullOrEmpty(Code)) { return "请输入验证码!"; } if (Session[Keys.SESSION_CODE] == null) { return "验证码已过期,请刷新验证码!"; } if (Code.ToLower() != Session[Keys.SESSION_CODE].ToString().ToLower()) { return "您输入的验证码不正确!"; } if (!gum.IsGameUser(UserName)) { return "您输入的用户不存在!"; } GameUser gu = new GameUser(); gu = gum.GetGameUser(UserName, DESEncrypt.Md5(PWD, 32)); if (gu == null) { return "您输入的用户或密码有误!"; } if (gu.IsLock == 1) { return "您输入的用户或密码有误!"; } if (alm.IsLock(BBRequest.GetIP())) { return "您输入的用户或密码有误!"; } Session[Keys.SESSION_USER] = gu.Id; Session.Timeout = 120; gum.UpdateLastLogin(gu.Id); if (Request["ck1"] == "on") { Utils.WriteCookie("6qmgamesame", DESEncrypt.DesEncrypt(UserName) + "|" + DESEncrypt.DesEncrypt(PWD), 10080); } else { Utils.WriteCookie("6qmgamesame", "", -10); } return "True"; }
/// <summary> /// 怒斩充值接口 /// </summary> /// <param name="OrderNo">订单号</param> /// <returns>返回充值结果</returns> public string Pay(string OrderNo) { order = os.GetOrder(OrderNo); //获取用户的充值订单 gu = gus.GetGameUser(order.UserName); //获取充值用户 gs = gss.GetGameServer(order.ServerId); //获取用户要充值的服务器 string PayGold = (order.PayMoney * game.GameMoneyScale).ToString(); //计算支付的游戏币 if (gus.IsGameUser(gu.UserName)) //判断用户是否属于平台 { tstamp = Utils.GetTimeSpan(); //获取时间戳 Sign = DESEncrypt.Md5(order.PayMoney + gu.Id.ToString() + OrderNo + tstamp + gc.PayTicket, 32); string PayUrl = "http://" + gs.ServerNo + "." + gc.PayCom + "exchange.php?amount=" + order.PayMoney + "&u=" + gu.Id + "&order_no=" + OrderNo + "&time=" + tstamp + "&sign=" + Sign; GameUserInfo gui = Sel(gu.Id, gs.Id); //获取玩家查询信息 if (gui.Message == "Success") //判断玩家是否存在 { if (order.State == 1) //判断订单状态是否为支付状态 { string PayResult = Utils.GetWebPageContent(PayUrl); //获取充值结果 switch (PayResult) //对充值结果进行解析 { case "success": if (os.UpdateOrder(order.OrderNo)) //更新订单状态为已完成 { gus.UpdateGameMoney(gu.UserName, order.PayMoney); //跟新玩家游戏消费情况 return "充值成功!"; } else { return "充值失败!错误原因:更新订单状态失败!"; } case "err_time": return "充值失败!错误原因:订单请求超时!"; case "err_sign": return "充值失败!错误原因:验证参数错误!"; case "err_repeat": return "充值失败!错误原因:无法提交重复订单!"; case "fail": return "充值失败!错误原因:其它错误!"; default: return "充值失败!未知错误!"; } } else { return "充值失败!错误原因:无法提交未支付订单!"; } } else { return "充值失败!角色不存在!"; } } else { return "充值失败!用户不存在!"; } }
/// <summary> /// 盗魂传充值接口 /// </summary> /// <param name="OrderNo">订单号</param> /// <returns>返回充值结果</returns> public string Pay(string OrderNo) { order = os.GetOrder(OrderNo); //获取用户的充值订单 gu = gus.GetGameUser(order.UserName); //获取充值用户 gs = gss.GetGameServer(order.ServerId); //获取用户要充值的服务器 string PayGold = (order.PayMoney * game.GameMoneyScale).ToString(); //计算支付的游戏币 if (gus.IsGameUser(gu.UserName)) //判断用户是否属于平台 { tstamp = Utils.GetTimeSpan(); //获取时间戳 Sign = DESEncrypt.Md5(gc.AgentId + "|" + gu.UserName + "|" + gs.ServerNo + "|" + tstamp + "|" + OrderNo + "|" + PayGold + "|" + gc.PayTicket, 32); //获取验证参数 string PayUrl = "http://" + gc.PayCom + "?ptid=" + gc.AgentId + "&account=" + gu.UserName + "&areaid=" + gs.ServerNo + "&tt=" + tstamp + "&orderno=" + OrderNo + "&point=" + PayGold + "&sign=" + Sign; GameUserInfo gui = Sel(gu.Id, gs.Id); //获取玩家查询信息 if (gui.Message == "Success") //判断玩家是否存在 { if (order.State == 1) //判断订单状态是否为支付状态 { string PayResult = Utils.GetWebPageContent(PayUrl); //获取充值结果 PayResult = PayResult.Substring(0, PayResult.IndexOf('}')); //处理返回结果 PayResult = PayResult.Replace(PayResult.Substring(0, PayResult.LastIndexOf('{') + 1), ""); string[] b = PayResult.Split(','); switch (b[0].Substring(13)) //对充值结果进行解析 { case "0": if (os.UpdateOrder(order.OrderNo)) //更新订单状态为已完成 { gus.UpdateGameMoney(gu.UserName, order.PayMoney); //跟新玩家游戏消费情况 return "充值成功!"; } else { return "充值失败!错误原因:更新订单状态失败!"; } case "1": return "充值失败!错误原因:商家错误或者不存在!"; case "2": return "订单重复,之前已经处理成功!"; default: return "充值失败!未知错误!"; } } else { return "充值失败!错误原因:无法提交未支付订单!"; } } else { return "充值失败!角色不存在!"; } } else { return "充值失败!用户不存在!"; } }
/// <summary> /// 天界登录接口 /// </summary> /// <param name="UserId">用户Id</param> /// <param name="ServerId">服务器Id</param> /// <returns>返回登录地址</returns> public string Login(int UserId, int ServerId, int IsPC) { gu = gus.GetGameUser(UserId); //获取要登录用户 gs = gss.GetGameServer(ServerId); //获取要登录的服务器 tstamp = Utils.GetTimeSpan(); //获取时间戳 Base64Protector bp = new Base64Protector(); Auth = bp.Base64Code(string.Format("sid={0}&uid={1}&time={2}&indulge={3}", gs.ServerNo, gu.UserName, tstamp, "n")); Sign = DESEncrypt.Md5(Auth + gc.LoginTicket, 32); //获取验证参数 string LoginUrl = "http://" + gc.LoginCom + "?auth=" + Auth + "&sign=" + Sign; return LoginUrl; }
/// <summary> /// 猎魔登陆接口 /// </summary> /// <param name="Id">用户Id</param> /// <param name="ServerId">服务器Id</param> /// <param name="IsPc">是否PC端登陆</param> /// <returns></returns> public string Login(int Id, int ServerId, int IsPc) { gu = gus.GetGameUser(Id); //获取当前登录用户 gs = gss.GetGameServer(ServerId); //获取用户要登录的服务器 tstamp = Utils.GetTimeSpan(); //获取时间戳 Sign = DESEncrypt.Md5(gc.AgentId + "|" + gu.Id + "|1233|" + gs.ServerNo + "|" + tstamp + "|1|" + gc.LoginTicket, 32); //获取验证码 string LoginDelURL = "http://" + gc.LoginCom + "?site=" + gc.AgentId + "&uid=" + gu.Id + "&game=1233&num=" + gs.ServerNo + "&fcm=1&time=" + tstamp + "&sign=" + Sign; string LoginResult = Utils.GetWebPageContent(LoginDelURL); string[] R = LoginResult.Replace("[", "").Replace("]", "").Split(','); string LoginUrl = R[1].Replace("\"", "").Replace("\\", ""); ; return LoginUrl; }
/// <summary> /// 热血海贼王充值接口 /// </summary> /// <param name="OrderNo">订单号</param> /// <returns></returns> public string Pay(string OrderNo) { order = os.GetOrder(OrderNo); //获取用户的充值订单 gu = gus.GetGameUser(order.UserName); //获取充值用户 gs = gss.GetGameServer(order.ServerId); //获取用户要登录的服务器 if (gus.IsGameUser(gu.UserName)) //判断用户是否属于平台 { tstamp = Utils.GetTimeSpan(); //获取时间戳 string PayGold = (order.PayMoney * game.GameMoneyScale).ToString(); //计算支付的游戏币 Sign = DESEncrypt.Md5(gu.Id.ToString() + order.PayMoney + OrderNo + gs.ServerNo + gc.PayTicket, 32); //获取验证参数 string PayUrl = "http://" + gs.ServerNo + "." + gc.PayCom + "?qid=" + gu.Id + "&order_amount=" + order.PayMoney + "&order_id=" + OrderNo + "&server_id=" + gs.ServerNo + "&sign=" + Sign; GameUserInfo gui = Sel(gu.Id, gs.Id); //获取玩家查询信息 if (gui.Message == "Success") //判断玩家是否存在 { if (order.State == 1) //判断订单状态是否为支付状态 { string PayResult = Utils.GetWebPageContent(PayUrl); //获取充值返回结果 switch (PayResult) //对充值结果进行解析 { case "1": if (os.UpdateOrder(order.OrderNo)) //更新订单状态为已完成 { gus.UpdateGameMoney(gu.UserName, order.PayMoney); //跟新玩家游戏消费情况 return "充值成功!"; } else { return "充值失败!错误原因:更新订单状态失败!"; } case "2": return "充值失败!无法提交重复订单!"; case "0": return "充值失败!未知原因!"; default: return "充值失败!未知错误!"; } } else { return "充值失败!错误原因:无法提交未支付订单!"; } } else { return gui.Message; } } else { return "充值失败!用户不存在!"; } }
/// <summary> /// 大侠传登录接口 /// </summary> /// <param name="UserId">用户Id</param> /// <param name="ServerId">服务器Id</param> /// <returns>返回登录地址</returns> public string Login(int UserId, int ServerId, int IsPC) { gu = gus.GetGameUser(UserId); //获取当前登录用户 gs = gss.GetGameServer(ServerId); //获取用户要登录的服务器 tstamp = Utils.GetTimeSpan(); //获取时间戳 string url = string.Format("op_id={0}&sid={1}&game_id={2}&account={3}&adult_flag={4}&game_time={5}&ip={6}&ad_info={7}&time={8}", gc.AgentId, gs.ServerNo, 8, gu.UserName, 1, 13359459, BBRequest.GetIP(), "", tstamp); //获取验证字符串 Base64Protector bp = new Base64Protector(); Auth = bp.Base64Code(url); //获取验证码 Sign = DESEncrypt.Md5(Auth + gc.LoginTicket, 32); //获取验证参数 string LoginUrl = "http://" + gc.LoginCom + "?auth=" + Auth + "&verify=" + Sign; //生成登录地址 return LoginUrl; }
/// <summary> /// 添加一个用户 /// </summary> /// <param name="gu">用户</param> /// <returns></returns> public Boolean AddUser(GameUser gu) { try { string sql = "insert into game_users(username,pwd,nick,sex,phone,tel,realname,email,qq,birthday,cards,photo,source,userdesc,isvalidate,isvaliphone,isvalicard,islock,isspreader,gradeid,addtime,lastlogintime,points,money,gamemoney,rebatemoney,ip,from_url,reggame,spvalue,annalID)" + "values (@UserName,@PWD,@Nick,@Sex,@Phone,@Tel,@RealName,@Email,@QQ,@Birthday,@Cards,@Photo,@Source,@UserDesc,@IsValiDate,@IsValiPhone,@IsValiCard,@IsLock,@IsSpreader,@GradeId,@AddTime,@LastLoginTime,@Points,@Money,@GameMoney,@RebateMoney,@IP,@From_URL,@RegGame,@Spvalue,@annalID)"; SqlParameter[] sp = new SqlParameter[] { new SqlParameter("@UserName",gu.UserName), new SqlParameter("@PWD",gu.PWD), new SqlParameter("@Nick",gu.Nick), new SqlParameter("@Sex", gu.Sex), new SqlParameter("@Phone",gu.Phone), new SqlParameter("@Tel",gu.Tel), new SqlParameter("@RealName", gu.RealName), new SqlParameter("@Email",gu.Email), new SqlParameter("@QQ",gu.QQ), new SqlParameter("@Birthday", gu.BirthDay), new SqlParameter("@Cards",gu.Cards), new SqlParameter("@Photo",gu.Photo), new SqlParameter("@Source",gu.Source), new SqlParameter("@UserDesc", gu.UserDesc), new SqlParameter("@IsValiDate",gu.IsValiDate), new SqlParameter("@IsValiPhone",gu.IsValiPhone), new SqlParameter("@IsValiCard", gu.IsValiCard), new SqlParameter("@IsLock",gu.IsLock), new SqlParameter("@IsSpreader",gu.IsSpreader), new SqlParameter("@GradeId", gu.GradeId), new SqlParameter("@AddTime",gu.AddTime), new SqlParameter("@LastLoginTime",gu.LastLoginTime), new SqlParameter("@Points", gu.Points), new SqlParameter("@Money",gu.Money), new SqlParameter("@GameMoney",gu.GameMoney), new SqlParameter("@RebateMoney",gu.RebateMoney), new SqlParameter("@IP", gu.Ip), new SqlParameter("@From_URL", gu.From_Url), new SqlParameter("@RegGame",gu.RegGame), new SqlParameter("@Spvalue",gu.SpValue), new SqlParameter("@annalID",gu.annalID) }; return db.ExecuteNonQuery(sql, sp); } catch (SqlException ex) { throw new Exception("数据库异常!原因:" + ex.Message); } catch (Exception ex) { throw new Exception("未知异常!原因:" + ex.Message); } }
/// <summary> /// 九龙朝登陆接口 /// </summary> /// <param name="UserId">用户Id</param> /// <param name="ServerId">服务器Id</param> /// <param name="IsPC">是否PC端登陆</param> /// <returns>返回登陆地址</returns> public string Login(int UserId, int ServerId, int IsPC) { gu = gus.GetGameUser(UserId); //获取当前登录用户 gs = gss.GetGameServer(ServerId); //获取用户要登录的服务器 tstamp = Utils.GetTimeSpan(); //获取时间戳 string url = string.Format("sid={0}&uid={1}&time={2}&indulge={3}", gs.ServerNo, gu.UserName, tstamp, "n"); //获取验证字符串 Base64Protector bp = new Base64Protector(); Auth = bp.Base64Code(url); //获取验证码 Sign = DESEncrypt.Md5(Auth + gc.LoginTicket, 32); //获取验证参数 string LoginUrl = "http://" + gc.LoginCom + "?auth=" + Auth + "&sign=" + Sign; //生成登录地址 if (IsPC == 1) { LoginUrl += "&play_gamecode&isclient=1"; } return LoginUrl; }
/// <summary> /// 江湖问剑登录接口 /// </summary> /// <param name="UserId">用户Id</param> /// <param name="ServerId">服务器Id</param> /// <param name="IsPC">是否PC端登录</param> /// <returns>返回登录接口</returns> public string Login(int UserId, int ServerId, int IsPC) { gu = gus.GetGameUser(UserId); //获取当前登录用户 gs = gss.GetGameServer(ServerId); //获取用户要登录的服务器 tstamp = Utils.GetTimeSpan(); //获取时间戳 Sign = DESEncrypt.Md5("fcm" + "n" + "gid" + "221" + "pid" + gc.AgentId + "sid" + gs.QuFu + "time" + tstamp + "uid" + gu.UserName + gc.LoginTicket, 32); //获取验证码 string LoginUrl = "http://" + gc.LoginCom + "?pid=" + gc.AgentId + "&gid=221&sid=" + gs.QuFu + "&uid=" + gu.UserName + "&time=" + tstamp + "&fcm=n&sign= " + Sign; if (IsPC == 1) { LoginUrl += "&client=pc"; } else { LoginUrl += "&client=web"; } return LoginUrl; }
public Boolean AddLock() { if (Session[Keys.SESSION_ADMIN_INFO] == null) { return false; } else { Master master = Session[Keys.SESSION_ADMIN_INFO] as Master; if (rcm.GetRoleCompetence(master.RoleId, 1341)) { string Lock = Request["LockInfo"]; string LockInfo = "Ip锁定"; try { int s = 0; string[] a = DESEncrypt.Decrypt(Lock).Split('|'); string b = a[0]; string c = a[1]; if (int.TryParse(a[0], out s) && int.TryParse(a[1], out s)) { GameUser gu = new GameUser(); gu = gum.GetGameUser(int.Parse(a[0])); Games g = gm.GetGame(int.Parse(a[1])); if (gu != null) { if (gu.IsSpreader > 0) { LockInfo = gu.UserName + "的" + g.Name + "链接"; } } } } catch (Exception) { } if (!string.IsNullOrEmpty(Lock) && !alm.IsLock(Lock)) { return alm.AddLock(Lock, master.UserName, LockInfo); } } } return false; }