public string DoGetGift(int CardId, string CardNum) { cardsname cn = new cardsname(); cn = cm.GetCard(CardId); g = gm.GetGame(cn.gameid); if (cm.GetCardCount(CardId) < 1) { return("<span><b>温馨提示:</b><lable style=\"color:red\">该新手卡已经被抢空啦!</span>"); } int UserId = BBRequest.GetUserId(); if (UserId <= 0) { if (Utils.GetCookie("6qmgamesame") != "") { string value = Utils.GetCookie("6qmgamesame"); string UserName = DESEncrypt.DesDecrypt(value.Split('|')[0]); string PWD = DESEncrypt.DesDecrypt(value.Split('|')[1]); GameUser gu = gum.GetGameUser(UserName, DESEncrypt.Md5(PWD, 32)); if (gu != null) { BBRequest.WriteUserId(gu.Id); gum.UpdateLastLogin(gu.Id); UserId = BBRequest.GetUserId(); } else { return("<span><b>温馨提示:</b><lable style=\"color:red\">登录后才可领取!</lable></span>"); } } else { return("<span><b>温馨提示:</b><lable style=\"color:red\">登录后才可领取!</lable></span>"); } } if (CardNum == null) { if (cm.ExitCardLog(UserId, CardId)) { return("<span id=\"showno\" ><b>温馨提示:</b><lable style=\"color:red\">您已经领取过该新手卡啦!</span>"); } else { cards c = new cards(); c = cm.GetCards(CardId); CardNum = c.cardnum; cardslog cl = new cardslog(); cl.userid = UserId; cl.cardid = CardId; cl.cardsid = c.id; cm.AddCardLog(cl); cm.UpdateCard(1, c.id); sysmsg sysmsg1 = new sysmsg(); sysmsg1.msgid = 0; sysmsg1.title = "新手卡信息:" + cn.cardname; sysmsg1.type = 2; sysmsg1.userid = UserId; sysmsg1.msg = "领取新手卡成功!卡号:" + c.cardnum; sysmsg1.fromid = 0; new SysMsgManager().AddSysMsg(sysmsg1); return("<span id=\"showno\" ><b>领取成功!激活码:</b> <label id=\"lblno\" style=\"color:red\"> " + CardNum + " </label></span>"); } } else { return("<span id=\"showno\" ><b>领取成功!激活码:</b> <label id=\"lblno\" style=\"color:red\"> " + CardNum + " </label></span>"); } }
public ActionResult LoginGame(string GameNo, int Qf) { g = gm.GetGame(GameNo); GameServer gs = new GameServer(); gs = sm.GetGameServer(g.Id, Qf); ViewData["Title"] = "5577yx-" + g.Name; ViewData["ServerName"] = g.Name + "-" + gs.Name; ViewData["GameNo"] = g.GameNo; ViewData["Qf"] = Qf; if (gs.State == 1 && gs.StartTime < DateTime.Now) { gs.State = 4; sm.UpdateServer(gs); } if (gs.State != 1 && gs.StartTime > DateTime.Now) { gs.State = 1; sm.UpdateServer(gs); } if (gs.State == 1 && gs.StartTime > DateTime.Now) { TimeSpan ts = gs.StartTime - DateTime.Now; ViewData["TimeSpan"] = ts.TotalMilliseconds; } if (gs.State == 1 || gs.State == 2) { ViewData["State"] = gs.State; return(View("~/Views/GameCenter/LoginGame.cshtml")); } int UserId = BBRequest.GetUserId(); if (UserId > 0) { ViewData["LoginUrl"] = gm.LoginUrl(g.Id, UserId, gs.Id, 0); gum.UpdateLastLogin(UserId); OnlineLog ol = new OnlineLog(0, UserId, g.Id, gs.Id, DateTime.Now, 0, 0); new OnlineLogManager().AddOnlineLog(ol); } else { if (Utils.GetCookie("6qmgamesame") != "") { string value = Utils.GetCookie("6qmgamesame"); string UserName = DESEncrypt.DesDecrypt(value.Split('|')[0]); string PWD = DESEncrypt.DesDecrypt(value.Split('|')[1]); GameUser gu = gum.GetGameUser(UserName, DESEncrypt.Md5(PWD, 32)); if (gu != null) { BBRequest.WriteUserId(gu.Id); gum.UpdateLastLogin(gu.Id); ViewData["LoginUrl"] = gm.LoginUrl(g.Id, gu.Id, gs.Id, 0); OnlineLog ol = new OnlineLog(0, gu.Id, g.Id, gs.Id, DateTime.Now, 0, 0); new OnlineLogManager().AddOnlineLog(ol); } else { return(RedirectToAction("Login", "Home")); } } else { return(RedirectToAction("Login", "Home")); } } return(View("~/Views/GameCenter/LoginGame.cshtml")); }