Exemple #1
0
 /// <summary>
 /// 添加一条系统消息
 /// </summary>
 /// <param name="sm">消息</param>
 /// <returns>返回是否添加成功</returns>
 public Boolean AddSysMsg(sysmsg sm)
 {
     try
     {
         string sql = "insert into sysmsg(type,title,msg,userid,fromid,msgid)"
                    + "values (@type,@title,@msg,@userid,@fromid,@msgid)";
         SqlParameter[] sp = new SqlParameter[]
         {
             new SqlParameter("@type",sm.type),
             new SqlParameter("@title",sm.title),
             new SqlParameter("@msg",sm.msg),
             new SqlParameter("@userid", sm.userid),
             new SqlParameter("@fromid",sm.fromid),
             new SqlParameter("@msgid",sm.msgid)
         };
         return db.ExecuteNonQuery(sql, sp);
     }
     catch (SqlException ex)
     {
         throw new Exception("数据库异常!原因:" + ex.Message);
     }
     catch (Exception ex)
     {
         throw new Exception("未知异常!原因:" + ex.Message);
     }
 }
 public string AddUnderSpreader()
 {
     GameUser gu = new GameUser();
     string UserName = Request["UserName"].Trim();
     string Pwd = Request["PWD"].Trim();
     int UserId = BBRequest.GetUserId();
     if (UserId > 0)
     {
         GameUser Spreader = gum.GetGameUser(UserId);
         if (Spreader.IsSpreader > 1)
         { }
         else
         {
             return "您不是推广团长,不能添加推广员!";
         }
     }
     else
     {
         return "您还未登陆,不能添加推广员!";
     }
     if (!DevRegHel.RegName(UserName))
     {
         return "您输入的用户名不可用!";
     }
     if (!DevRegHel.RegPwd(Pwd))
     {
         return "您输入的密码不可用!";
     }
     if (alm.IsLock(BBRequest.GetIP()))
     {
         return "您暂时不能注册!";
     }
     gu = new GameUser(0, Request["UserName"], DESEncrypt.Md5(Request["PWD"], 32), "", "0", "", "", "", ""
           , "", "", "", "1", UserId, "", 0, 0, 0, 0, 1, 0, DateTime.Now, DateTime.Now, 0, 0, 0, 0, BBRequest.GetIP(),
           "", 0, "", "");
     try
     {
         if (gum.AddUser(gu))
         {
             int Id = gum.GetGameUser(UserName).Id;
             sysmsg sm = new sysmsg();
             sm.title = "注册成功消息";
             sm.type = 2;
             sm.userid = Id;
             sm.fromid = 0;
             sm.msg = "恭喜您成功注册5577游戏账号,您可凭借此账号登录5577游戏旗下任何一款游戏,祝您游戏愉快。如果您在游戏过程中遇到任何问题,欢迎您致电客服咨询。";
             smm.AddSysMsg(sm);
             //Session[Keys.SESSION_USER] = Id;
             //Session.Timeout = 120;
             //validatecode vdc = new validatecode();
             //vdcm.DelValiDateCode(Id, 1);
             //vdc.type = 1;
             //vdc.userid = Id;
             //vdc.sendtime = DateTime.Now;
             //vdc.code = Guid.NewGuid().ToString() + DateTime.Now.Minute + DateTime.Now.Millisecond;
             //vdc.email = gu.Email.Trim();
             //vdcm.AddValiDateCode(vdc);
             //string ucode = DESEncrypt.encryptstring1(vdc.userid.ToString());
             //string tcode = DESEncrypt.encryptstring1(vdc.type.ToString());
             //string scode = vdc.code.ToString();
             //string vicode = vdc.sendtime.ToString("yyyy-MM-ddHH:mm:ss");
             return "True";
         }
         else
         {
             return "注册失败!";
         }
     }
     catch (Exception ex)
     {
         gu.IsLock = 1;
         gu.UserDesc = "此用户为注册失败用户!失败原因:" + ex.Message;
         gum.UpdateUser(gu);
         //gum.DelGameUser(UserName);
         return "注册失败!错误:" + ex.Message;
     }
 }
Exemple #3
0
 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>";
     }
 }
Exemple #4
0
 public string DoReg()
 {
     GameUser gu = new GameUser();
     string UserName = Request["UserName"].Trim();
     string Pwd = Request["PWD"].Trim();
     string Card = Request["Card"].Trim();
     string Email = Request["Email"].Trim();
     string Code = Request["Code"].Trim();
     if (!DevRegHel.RegName(UserName))
     {
         return "您输入的用户名不可用!";
     }
     if (!DevRegHel.RegPwd(Pwd))
     {
         return "您输入的密码不可用!";
     }
     if (!DevRegHel.RegCard(Card))
     {
         return "您输入的身份证不可用!";
     }
     if (!DevRegHel.RegEmail(Email))
     {
         return "您输入的邮箱不可用!";
     }
     if (gum.IsGameUser(UserName))
     {
         return "您输入的用户名已被注册!";
     }
     if (Session[Keys.SESSION_CODE] == null)
     {
         return "验证码已过期,请刷新验证码!";
     }
     if (Session[Keys.SESSION_CODE].ToString().ToUpper() != Code.ToUpper())
     {
         return "您输入的验证码不正确!";
     }
     if (Request["Ck"].Trim() != "on")
     {
         return "请务必确认您已经阅读服务条款!";
     }
     if (alm.IsLock(BBRequest.GetIP()))
     {
         return "您暂时不能注册!";
     }
     if (gum.ExitEmail(Request["Email"]))
     {
         return "您的邮箱已经注册过!";
     }
     gu = new GameUser(0, Request["UserName"], DESEncrypt.Md5(Request["PWD"], 32), "", Request["Sex"], "", "", Request["RealName"], Request["Email"]
         , "", Request["Birthday"], Request["Card"], "1", 0, "", 0, 0, 0, 0, 0, 0, DateTime.Now, DateTime.Now, 0, 0, 0, 0, BBRequest.GetIP(),
         "", 0, "", "");
     try
     {
         if (gum.AddUser(gu))
         {
             int Id = gum.GetGameUser(UserName).Id;
             sysmsg sm = new sysmsg();
             sm.title = "注册成功消息";
             sm.type = 2;
             sm.userid = Id;
             sm.fromid = 0;
             sm.msg = "恭喜您成功注册5577游戏账号,您可凭借此账号登录5577游戏旗下任何一款游戏,祝您游戏愉快。如果您在游戏过程中遇到任何问题,欢迎您致电客服咨询。";
             smm.AddSysMsg(sm);
             Session[Keys.SESSION_USER] = Id;
             Session.Timeout = 120;
             validatecode vdc = new validatecode();
             vdcm.DelValiDateCode(Id, 1);
             vdc.type = 1;
             vdc.userid = Id;
             vdc.sendtime = DateTime.Now;
             vdc.code = Guid.NewGuid().ToString() + DateTime.Now.Minute + DateTime.Now.Millisecond;
             vdc.email = gu.Email.Trim();
             vdcm.AddValiDateCode(vdc);
             //string ucode = DESEncrypt.encryptstring1(vdc.userid.ToString());
             //string tcode = DESEncrypt.encryptstring1(vdc.type.ToString());
             //string scode = vdc.code.ToString();
             //string vicode = vdc.sendtime.ToString("yyyy-MM-ddHH:mm:ss");
             return "True";
         }
         else
         {
             return "注册失败!";
         }
     }
     catch (Exception ex)
     {
         gu.IsLock = 1;
         gu.UserDesc = "此用户为注册失败用户!失败原因:" + ex.Message;
         gum.UpdateUser(gu);
         //gum.DelGameUser(UserName);
         return "注册失败!错误:" + ex.Message;
     }
 }
Exemple #5
0
 /// <summary>
 /// 通过分页获取系统消息
 /// </summary>
 /// <param name="PageSize">页大小</param>
 /// <param name="PageNum">页码</param>
 /// <param name="WhereStr">条件</param>
 /// <param name="OrderBy">排序</param>
 /// <returns></returns>
 public List<sysmsg> GetAllSysMsg(int PageSize, int PageNum, string WhereStr, string OrderBy)
 {
     List<sysmsg> list = new List<sysmsg>();
     try
     {
         SqlParameter[] sp = new SqlParameter[] {
         new SqlParameter("@PageSize",PageSize),
         new SqlParameter("@PageNum",PageNum),
         new SqlParameter("@TableName","sysmsg"),
         new SqlParameter("@WhereStr",WhereStr),
         new SqlParameter("@OrderBy",OrderBy)
         };
         using (SqlDataReader reder = db.GetReaderByProc("Proc_Page", sp))
         {
             while (reder.Read())
             {
                 sysmsg sm = new sysmsg();
                 sm.id = (int)reder["id"];
                 sm.type = (int)reder["type"];
                 sm.title = reder["title"].ToString();
                 sm.msg = reder["msg"].ToString();
                 sm.msgid = (int)reder["msgid"];
                 sm.state = (int)reder["state"];
                 sm.userid = (int)reder["userid"];
                 sm.addtime = (DateTime)reder["addtime"];
                 list.Add(sm);
             }
         }
     }
     catch (SqlException ex)
     {
         throw new Exception("数据库异常!原因:" + ex.Message);
     }
     catch (Exception ex)
     {
         throw new Exception("未知异常!原因:" + ex.Message);
     }
     return list;
 }
Exemple #6
0
 /// <summary>
 /// 添加一条系统消息
 /// </summary>
 /// <param name="sm">消息</param>
 /// <returns>返回是否添加成功</returns>
 public Boolean AddSysMsg(sysmsg sm)
 {
     return sms.AddSysMsg(sm);
 }
Exemple #7
0
 public string DoTg()
 {
     GameUser gu = new GameUser();
     string UserName = Request["UserName"].Trim();
     string Pwd = Request["PWD"].Trim();
     if (!DevRegHel.RegName(UserName))
     {
         return "您输入的用户名不可用!";
     }
     if (!DevRegHel.RegPwd(Pwd))
     {
         return "您输入的密码不可用!";
     }
     if (alm.IsLock(BBRequest.GetIP()))
     {
         return "您暂时不能注册!";
     }
     try
     {
         string Action = Request["Action"];
         int Source = 0;
         int RegGame = 0;
         Games g = new Games();
         if (string.IsNullOrEmpty(Action))
         {
             return "缺少参数!";
         }
         else if (alm.IsLock(Action) || alm.IsLock(BBRequest.GetIP()))
         {
             return "参数错误!";
         }
         else
         {
             int s = 0;
             string[] a = DESEncrypt.Decrypt(Action).Split('|');
             string b = a[0];
             string c = a[1];
             if (int.TryParse(a[0], out s) && int.TryParse(a[1], out s))
             {
                 gu = gum.GetGameUser(int.Parse(a[0]));
                 if (gu != null)
                 {
                     if (gu.IsSpreader > 0)
                     {
                         Source = int.Parse(a[0]);
                         RegGame = int.Parse(a[1]);
                         g = gm.GetGame(RegGame);
                         if (!(g.tjqf > 0))
                         {
                             return "游戏还未设置推荐服务器!";
                         }
                     }
                     else
                     {
                         return "参数错误!";
                     }
                 }
             }
         }
         gu = new GameUser(0, Request["UserName"], DESEncrypt.Md5(Request["PWD"], 32), "", "0", "", "", "", ""
           , "", "", "", "1", Source, "", 0, 0, 0, 0, 0, 0, DateTime.Now, DateTime.Now, 0, 0, 0, 0, BBRequest.GetIP(),
           "", RegGame, "", "");
         if (Session["annalID"] != null)
         {
             string annalID = Session["annalID"].ToString().Trim();
             if (!string.IsNullOrEmpty(annalID))
             {
                 gu.annalID = annalID;
                 gu.From_Url = "BengBeng";
                 string SelUrl = "http://www.bengbeng.com/reannal.php?adID=2618&annalID=" + annalID + "&idCode=" + gu.UserName + "&doukey=" + DESEncrypt.Md5("2618" + annalID + gu.UserName + "06bd24c6124b2dd7", 32);
                 string SleRes = Utils.GetWebPageContent(SelUrl);
                 Dictionary<string, string> Jd = Common.Json.JsonToArray(SleRes);
                 if (Jd["result"] != "1")
                 {
                     return Jd["message"];
                 }
             }
             else
             {
                 return "缺少参数!";
             }
         }
         if (gum.AddUser(gu))
         {
             int Id = gum.GetGameUser(UserName).Id;
             sysmsg sm = new sysmsg();
             sm.title = "注册成功消息";
             sm.type = 2;
             sm.userid = Id;
             sm.fromid = 0;
             sm.msg = "恭喜您成功注册5577游戏账号,您可凭借此账号登录5577游戏旗下任何一款游戏,祝您游戏愉快。如果您在游戏过程中遇到任何问题,欢迎您致电客服咨询。";
             smm.AddSysMsg(sm);
             Session[Keys.SESSION_USER] = Id;
             Session.Timeout = 120;
             GameServer gs = new ServersMananger().GetGameServer(g.tjqf);
             return g.GameNo + "|" + gs.QuFu;
         }
         else
         {
             return "注册失败!";
         }
     }
     catch (Exception ex)
     {
         gu.IsLock = 1;
         gu.UserDesc = "此用户为注册失败用户!失败原因:" + ex.Message;
         gum.UpdateUser(gu);
         //gum.DelGameUser(UserName);
         return "注册失败!错误:" + ex.Message;
     }
 }