예제 #1
0
 public static Error.MOBILE_ERROR_CODE CheckGroupLimit(int _forumId, int _meid)
 {
     //论坛限制性
     BCW.Model.Forum Forummodel = new BCW.BLL.Forum().GetForum(_forumId);
     //圈子限制性
     BCW.Model.Group modelgr = null;
     if (Forummodel.GroupId > 0)
     {
         modelgr = new BCW.BLL.Group().GetGroupMe(Forummodel.GroupId);
         if (modelgr == null)
         {
             return(Error.MOBILE_ERROR_CODE.BBS_GROUP_NOT_EXISTS);
         }
         else if (DT.FormatDate(modelgr.ExTime, 0) != "1990-01-01 00:00:00" && modelgr.ExTime < DateTime.Now)
         {
             return(Error.MOBILE_ERROR_CODE.BBS_GROUP_EXPIRE);
         }
         if (modelgr.ForumStatus == 2)
         {
             return(Error.MOBILE_ERROR_CODE.BBS_GROUP_CLOSED);
         }
         if (modelgr.ForumStatus == 1)
         {
             string GroupId = new BCW.BLL.User().GetGroupId(_meid);
             if (GroupId.IndexOf("#" + Forummodel.GroupId + "#") == -1 && IsCTID(_meid) == false)
             {
                 return(Error.MOBILE_ERROR_CODE.BBS_GROUP_VISIT_NO_LIMIT);
             }
         }
     }
     return(Error.MOBILE_ERROR_CODE.MOBILE_MSG_NONE);         //无错误
 }
예제 #2
0
        public void Login(string _account, string _pwd, bool platform = false)
        {
            //检查用户密码是否正确
            int _userRow = 0;

            string _md5Pwd = platform == true ? _pwd : Utils.MD5Str(_pwd);

            BCW.Model.User _user = new BCW.Model.User();

            _user.UsPwd = _md5Pwd;
            if (_account.ToString().Length == 11)
            {
                _user.Mobile = _account;
                _userRow     = new BCW.BLL.User().GetRowByMobile(_user);
            }
            else
            {
                _user.ID = int.Parse(_account);
                _userRow = new BCW.BLL.User().GetRowByID(_user);
            }

            if (_userRow <= 0)
            {
                rspLoginData.header.status     = ERequestResult.faild;
                rspLoginData.header.statusCode = MOBILE_ERROR_CODE.LOGIN_USER_PWD_ERROR;
                return;
            }


            _user = new BCW.BLL.User().GetKey(_userRow);


            int    UsId  = _user.ID;
            string UsKey = _user.UsKey;
            string UsPwd = _user.UsPwd;

            BCW.Model.User modelgetbasic = new BCW.BLL.User().GetBasic(_user.ID);

            //设置keys
            string keys = "";

            keys = BCW.User.Users.SetUserKeys(UsId, UsPwd, UsKey);
            string bUrl = string.Empty;

            if (Utils.getPage(1) != "")
            {
                bUrl = Utils.getUrl(Utils.removeUVe(Utils.getPage(1)));
            }
            else
            {
                bUrl = Utils.getUrl("/default.aspx");
            }
            //更新识别串
            string SID = ConfigHelper.GetConfigString("SID");

            bUrl = UrlOper.UpdateParam(bUrl, SID, keys);


            //----------------------写入日志文件作永久保存
            new BCW.BLL.User().UpdateTime(UsId);
            //APP全部在线登录
            new BCW.BLL.User().UpdateState(UsId, 0);

            TimeSpan timediff = DateTime.Now - Convert.ToDateTime("1970-01-01 00:00:00");
            long     stt      = (Int64)timediff.TotalMilliseconds;

            rspLoginData.header.status = ERequestResult.success;
            rspLoginData.user.keys     = keys;
            rspLoginData.user.userId   = UsId;
            rspLoginData.user.userName = modelgetbasic.UsName;
            rspLoginData.user.userImg  = "http://" + Utils.GetDomain() + modelgetbasic.Photo;
            rspLoginData.user.userKey  = UsKey;

            //获取用户管理版块
            int     GroupId = new BCW.BLL.Group().GetID(UsId);
            DataSet ds      = new BCW.BLL.Role().GetList("ID,UsName,RoleName,ForumID,ForumName,Include", "UsID=" + UsId + " and (OverTime>='" + DateTime.Now + "' OR OverTime='1990-1-1 00:00:00') and Status=0 ORDER BY FORUMID ASC");

            if (ds != null && ds.Tables[0].Rows.Count > 0 || GroupId > 0)
            {
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        rspLoginData.user.lstFLimit.Add(int.Parse(ds.Tables[0].Rows[i]["ForumID"].ToString()));
                    }
                }
            }
        }