Beispiel #1
0
        public virtual ActionResult Index()
        {
            Title = "事件";

            //     Events = DBExt.Event.GetFriendEvent(CHUser.UserId, 1, 20),
            ViewBag.LastViews = ViewLogLog.ViewList(0, 3, WebUser.UserId, 6);
            ViewBag.NewViews  = ViewLogLog.ViewList(2, 3, WebUser.UserId, 6);
            ViewBag.Page      = Gather.EventGather(WebUser.UserId);
            return(View());
        }
Beispiel #2
0
        /// <summary>
        /// 个人主页
        /// </summary>
        /// <returns></returns>
        public virtual ActionResult Index(long?userId)
        {
            if (!userId.HasValue && WebUser == null)
            {
                throw new ArgumentNullException("userId", @"当前用户不存在");
            }
            userId = userId ?? WebUser.UserId;
            var up = new UserIndexViewModel
            {
                OwnerId  = userId.Value,
                ViewerId = WebUser.UserId
            };

            ViewLogLog.Update(VisitLogType.Profile, up.OwnerId, WebUser);

            var user = UserInfo.UserInformation(up.OwnerId);

            if (user != null)
            {
                up.Profile  = user.Profile;
                up.Basic    = user.Basic;
                up.Relation = UserInfo.Relation(up.OwnerId, up.ViewerId);
            }
            ViewData["event"]      = EventLog.GetEvent(up.OwnerId, 1, 10);
            ViewData["lastview"]   = ViewLogLog.ViewList(0, 3, up.OwnerId, 6);
            ViewData["lastfriend"] = ViewLogLog.ViewList(2, 3, up.OwnerId, 6);
            ViewData["replylist"]  = Comment.GetReply(up.OwnerId, 1, 10);

            if (!up.Exists)
            {
                return(View(up));
            }
            up.IsOnline = OnlineProvider.Instance.Items.ContainsKey(up.OwnerId);
            Title       = up.Profile.Name + "的页面";
            return(View(up));
        }
Beispiel #3
0
        public virtual ActionResult Index(long id, int?p)
        {
            InitPage(ref p);

            #region 群信息和用户

            var g = Group.Get(id);
            if (g == null)
            {
                return(HttpNotFound("group not found"));
            }
            var u = Group.GetGroupUser(id, WebUser.UserId);
            if (u == null)
            {
                return(HttpNotFound("group user not found"));
            }
            ViewData["guser"] = u;
            Title             = g.Name;

            #endregion

            #region 权限计算

            int ret = g.ShowLevel;
            if (u.Status != (byte)GroupUserStatus.Wait)
            {
                ret = 0;
            }
            if (User.IsInRole("admin"))
            {
                ret = 0;
            }

            var userlevel = 0;
            if (User.IsInRole("admin"))
            {
                ret       = 0;
                userlevel = 255;
            }
            else
            {
                userlevel = u.Status;
            }
            ViewData["right"]     = userlevel;
            ViewData["showlevel"] = ret;

            #endregion

            #region 统计

            ViewData["MemberList"] = ViewLogLog.ViewList(6, 2, g.Id, 6);
            ViewData["ViewList"]   = ViewLogLog.ViewList(1, 6, g.Id, 6);

            ViewData["Applycount"] = Group.WaitJoinCount(id);

            var adminList = Group.GetAdmins(id);
            ViewData["adminlist"] = adminList;

            #endregion

            var posts = Note.GetNotes(id, NoteType.GroupPost, p.Value, 20);
            ViewData["posts"] = posts;
            return(View(g));
        }