/// <summary> /// 添加服务器信息 /// </summary> /// <param name="gs">服务器</param> /// <returns>返回是否添加成功</returns> public Boolean AddServer(GameServer gs) { try { string sql = "insert into gameserver(gameid,no,qufu,name,img,serverdesc,line,state,sort_id,starttime)" + "values (@GameId,@ServerNo,@QuFu,@Name,@Img,@ServerDesc,@Line,@State,@Sort_Id,@StartTime)"; SqlParameter[] sp = new SqlParameter[] { new SqlParameter("@GameId",gs.GameId), new SqlParameter("@ServerNo",gs.ServerNo), new SqlParameter("@QuFu",gs.QuFu), new SqlParameter("@Name",gs.Name), new SqlParameter("@Img",string.IsNullOrEmpty( gs.Img)?"":gs.Img), new SqlParameter("@ServerDesc",string.IsNullOrEmpty(gs.ServerDesc)?"":gs.ServerDesc), new SqlParameter("@Line",gs.Line), new SqlParameter("@State",gs.State), new SqlParameter("@Sort_Id",gs.Sort_Id), new SqlParameter("@StartTime",gs.StartTime) }; 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="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 "充值失败!用户不存在!"; } }
public Boolean DoAddServer() { if (Session[Keys.SESSION_ADMIN_INFO] == null) { return false; } else { Master master = Session[Keys.SESSION_ADMIN_INFO] as Master; if (rcm.GetRoleCompetence(master.RoleId, 11242)) { GameServer gs = new GameServer(); gs.GameId = int.Parse(Request["GameId"]); gs.ServerNo = Request["ServerNo"]; gs.QuFu = Request["QuFu"]; gs.Name = Request["ServerName"]; gs.Line = Request["Line"]; gs.State = int.Parse(Request["State"]); gs.StartTime = DateTime.Parse(Request["StartTime"]); gs.Sort_Id = int.Parse(Request["Sort_Id"]); gs.Img = Request["Img"]; gs.ServerDesc = Request["ServerDesc"]; return sm.AddServer(gs); } else { return false; } } }
/// <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("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("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("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> /// <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">是否客户端登陆</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; }
/// <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> /// <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">是否客户端</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(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 + 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.UserName + gc.LoginTicket + tstamp + "}", 32); //获取验证码 string LoginUrl = "http://" + gs.ServerNo + "." + gc.LoginCom + "?userName="******"&time=" + tstamp + "&sign=" + Sign + "&source=tt&serverId=" + gs.ServerNo; 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">是否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; }
/// <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; }
public string BengbengSel() { string UserName = Request["idCode"]; string GameNo = Request["GameNo"]; string Code = Request["Code"]; if (Code == DESEncrypt.Md5(UserName + GameNo + "717915FEC23F46D5", 32)) { try { GameUser gu = gum.GetGameUser(UserName); Games game = gm.GetGame(GameNo); List<string> list = olm.GetServerList(game.Id, gu.Id.ToString()); GameUserInfo gui = new GameUserInfo(); GameServer gs = new GameServer(); foreach (string server in list) { GameUserInfo gui2 = gm.GetGameUserInfo(game.Id, gu.Id, int.Parse(server)); if (gui2.Level > gui.Level) { gui = gui2; gs = sm.GetGameServer(int.Parse(server)); } } if (gui.Level > 0) { string Status = "0"; if (!string.IsNullOrEmpty(gu.annalID) && gu.From_Url == "BengBeng") { Status = "1"; } string Res = "{\"Result\":{\"Status\":\"" + Status + "\",\"UserID\":\"" + gu.Id + "\",\"UserName\":\"" + gu.UserName + "\",\"UserServer\":\"" + gs.QuFu + "\",\"ServerName\":\"" + gui.ServerName + "\",\"UserRole\":\"" + gui.UserName + "\",\"UserLevel\":\"" + gui.Level + "\",\"ChongZhi\":\"" + gui.Money + "\"}}"; return Res; } else { return "没有等级大于0的角色!"; } } catch (Exception ex) { return "查询异常:" + ex.Message; } } 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(); //获取时间戳 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; }