Ejemplo n.º 1
0
        /// <summary>
        /// 检查论坛回帖权限
        /// </summary>
        /// <param name="meid"></param>
        /// <param name="Replylt"></param>
        public static BCW.Mobile.Error.MOBILE_ERROR_CODE ShowAddReply(int meid, int Replylt)
        {
            Error.MOBILE_ERROR_CODE _result = Error.MOBILE_ERROR_CODE.MOBILE_MSG_NONE;
            if (Replylt <= 0)
            {
                return(_result);
            }
            //
            bool flag = false;

            switch (Replylt)
            {
            case 1:
                int num2 = BCW.User.Users.VipLeven(meid);
                if (num2 == 0)
                {
                    _result = Error.MOBILE_ERROR_CODE.BBS_THREAD_ADD_VIP;
                }
                break;

            case 2:
                flag = new BCW.BLL.Role().IsAllMode(meid);
                if (!flag)
                {
                    _result = Error.MOBILE_ERROR_CODE.BBS_THREAD_ADD_IS_ALLMODE;
                }
                break;

            case 3:
                flag = new BCW.BLL.Role().IsAdmin(meid);
                if (!flag)
                {
                    _result = Error.MOBILE_ERROR_CODE.BBS_THREAD_ADD_IS_ADMIN;
                }
                break;

            case 4:
                _result = Error.MOBILE_ERROR_CODE.BBS_THREAD_ADD_STOP;
                break;

            default:
                break;
            }
            return(_result);
            //
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 论坛发贴权限检查
        /// </summary>
        /// <param name="meid">会员Id</param>
        /// <param name="Postlt">1:是否VIP有权限发帖  2:是否版主或管理员才可发帖  3:是否管理员才可发帖 4:论坛禁止发帖</param>
        public static BCW.Mobile.Error.MOBILE_ERROR_CODE ShowAddThread(int meid, int Postlt)
        {
            bool flag = false;

            Error.MOBILE_ERROR_CODE _result = Error.MOBILE_ERROR_CODE.MOBILE_MSG_NONE;
            switch (Postlt)
            {
            case 1:
                int num2 = BCW.User.Users.VipLeven(meid);
                flag = (num2 != 0);
                if (!flag)
                {
                    _result = Error.MOBILE_ERROR_CODE.BBS_THREAD_ADD_VIP;
                }
                break;

            case 2:
                flag = new BCW.BLL.Role().IsAllMode(meid);
                if (!flag)
                {
                    _result = Error.MOBILE_ERROR_CODE.BBS_THREAD_ADD_IS_ALLMODE;
                }
                break;

            case 3:
                flag = new BCW.BLL.Role().IsAdmin(meid);
                if (!flag)
                {
                    _result = Error.MOBILE_ERROR_CODE.BBS_THREAD_ADD_IS_ADMIN;
                }
                break;

            case 4:
                _result = Error.MOBILE_ERROR_CODE.BBS_THREAD_ADD_STOP;
                break;

            default:
                _result = Error.MOBILE_ERROR_CODE.MOBILE_MSG_NONE;
                break;
            }
            return(_result);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 检查论坛访问限制
        /// </summary>
        /// <param name="meid">会员ID</param>
        /// <param name="Gradelt">可以访问的级别</param>
        /// <param name="Visitlt">特定访问对象(如管理员、版主)</param>
        /// <param name="VisitId">特定访问IP</param>
        /// <param name="IsPc">是否PC</param>
        /// <returns></returns>
        public static BCW.Mobile.Error.MOBILE_ERROR_CODE ShowForumLimit(int meid, int Gradelt, int Visitlt, string VisitId, int IsPc)
        {
            bool flag = false;

            #region Gradelt
            flag = (Gradelt <= 0);
            if (!flag)
            {
                if (meid == 0)
                {
                    return(Error.MOBILE_ERROR_CODE.SYS_USER_NOLOGIN);
                }
                //
                int leven = new BCW.BLL.User().GetLeven(meid);
                flag = (leven >= Gradelt);
                if (!flag)
                {
                    return(Error.MOBILE_ERROR_CODE.BBS_FORUM_VISIT_LIMIT_LEVEL);
                }
            }
            #endregion
            //
            #region Visitlt
            flag = (Visitlt <= 0);
            if (!flag)
            {
                if (meid == 0)
                {
                    return(Error.MOBILE_ERROR_CODE.SYS_USER_NOLOGIN);
                }
                //
                switch (Visitlt)
                {
                case 2:
                    int num2 = BCW.User.Users.VipLeven(meid);
                    if (num2 == 0)
                    {
                        return(Error.MOBILE_ERROR_CODE.BBS_FORUM_VISIT_LIMIT_VIP);
                    }
                    break;

                case 3:
                    flag = new BCW.BLL.Role().IsAllModeNoGroup(meid);
                    if (!flag)
                    {
                        return(Error.MOBILE_ERROR_CODE.BBS_FORUM_VISIT_LIMIT_BBS_MODERATOR);
                    }
                    break;

                case 4:
                    flag = new BCW.BLL.Role().IsAdmin(meid);
                    if (!flag)
                    {
                        return(Error.MOBILE_ERROR_CODE.BBS_FORUM_VISIT_LIMIT_ADMIN);
                    }
                    break;

                default:
                    break;
                }
            }
            #endregion
            //
            #region VisitID
            flag = string.IsNullOrEmpty(VisitId);
            if (!flag)
            {
                if (meid == 0)
                {
                    return(Error.MOBILE_ERROR_CODE.SYS_USER_NOLOGIN);
                }
                //
                VisitId = "#" + VisitId + "#";
                flag    = (VisitId.IndexOf("#" + meid + "#") != -1);
                if (!flag)
                {
                    return(Error.MOBILE_ERROR_CODE.BBS_FORUM_VISIT_LIMIT_IP);
                }
            }
            #endregion
            //
            #region IsPc
            flag = (IsPc != 1);
            if (!flag)
            {
                flag = Utils.IsMobileUa();
                if (!flag)
                {
                    return(Error.MOBILE_ERROR_CODE.BBS_FORUM_VISIT_LIMIT_MOBILE);
                }
            }

            return(Error.MOBILE_ERROR_CODE.MOBILE_MSG_NONE);

            #endregion
        }
Ejemplo n.º 4
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()));
                    }
                }
            }
        }