Example #1
0
        /// <summary>
        /// 频道——分类视频
        /// </summary>
        /// <param name="loginUserId">登录用户编号</param>
        /// <param name="cateId">分类编号</param>
        /// <param name="pageSize">显示多少条</param>
        /// <param name="pageIndex">显示多少行</param>
        /// <returns></returns>
        public AppChoicenesssView Videos(int?loginUserId, int cateId, int pageSize, int pageIndex)
        {
            AppChoicenesssView choicenesss = new AppChoicenesssView()
            {
                Choiceness = new List <AppChoicenessView>()
            };
            var userId   = loginUserId.HasValue ? Convert.ToInt32(loginUserId) : 0;
            var category = this._categoryRepository.GetEntityList(CondtionEqualState()).FirstOrDefault(c => c.Id == cateId);

            if (category != null)
            {
                var isLogin = IsLogin(this._userRepository.GetEntityList(), userId);
                IQueryable <AppChoicenessView> choicenessVideos = (from v in this._videoRepository.GetEntityList(CondtionEqualState())
                                                                   join c in this._categoryRepository.GetEntityList(CondtionEqualState()) on v.CategoryId equals c.Id
                                                                   join u in this._userRepository.GetEntityList(CondtionEqualState()) on v.CreateManageId equals u.Id
                                                                   where v.VideoSource == true &&
                                                                   v.VideoState == 3 &&
                                                                   c.LocationPath.StartsWith(category.LocationPath)
                                                                   orderby v.UpdateTime descending
                                                                   select new AppChoicenessView()
                {
                    IsSubed = isLogin && IsSubed(this._userFansRepository.GetEntityList(), u.Id, userId),
                    IsCollect = isLogin && IsCollect(this._userCollectRepository.GetEntityList(), (int)v.Id, userId),
                    UserInfo = UserEasyView(u),
                    VideoInfo = VideoView(v),
                    Comments = ParentComments((int)v.Id)
                });
                choicenesss.Choiceness = PageList(choicenessVideos, pageSize, pageIndex);
            }
            return(choicenesss);
        }
Example #2
0
        /// <summary>
        /// 精选视频
        /// </summary>
        /// <param name="loginUserId">登录用户编号(可空)</param>
        /// <param name="pageSize">显示多少条</param>
        /// <param name="pageIndex">显示多少页数</param>
        /// <returns></returns>
        public AppChoicenesssView ChoicenessVideos(int?loginUserId, int pageSize, int pageIndex)
        {
            AppChoicenesssView choicenesss = new AppChoicenesssView()
            {
                Choiceness = new List <AppChoicenessView>()
            };
            var userId  = loginUserId.HasValue ? Convert.ToInt32(loginUserId) : 0;
            var isLogin = IsLogin(this._userRepository.GetEntityList(), userId);
            IQueryable <AppChoicenessView> choicenessVideos = (from pv in this._plateVideoRepository.GetEntityList()
                                                               join p in this._plateRepository.GetEntityList() on pv.PlateId equals p.Id
                                                               join v in this._videoRepository.GetEntityList(CondtionEqualState()) on pv.VideoId equals v.Id
                                                               join u in this._userRepository.GetEntityList(CondtionEqualState()) on v.CreateManageId equals u.Id
                                                               where v.VideoSource == true &&
                                                               v.VideoState == 3
                                                               orderby v.UpdateTime descending
                                                               select new AppChoicenessView()
            {
                IsSubed = isLogin && IsSubed(this._userFansRepository.GetEntityList(), u.Id, userId),
                IsCollect = isLogin && IsCollect(this._userCollectRepository.GetEntityList(), (int)v.Id, userId),
                UserInfo = UserEasyView(u),
                VideoInfo = VideoView(v),
                Comments = ParentComments((int)v.Id)
            });

            choicenesss.Choiceness = PageList(choicenessVideos, pageSize, pageIndex);
            return(choicenesss);
        }
Example #3
0
        /// <summary>
        /// 朋友视频
        /// </summary>
        /// <param name="loginUserId">登录用户编号</param>
        /// <param name="pageSize">显示多少条</param>
        /// <param name="pageIndex">显示多少页数</param>
        /// <returns></returns>
        public AppChoicenesssView FriendVideos(int loginUserId, int pageSize, int pageIndex)
        {
            AppChoicenesssView choicenesss = new AppChoicenesssView()
            {
                Choiceness = new List <AppChoicenessView>()
            };
            var isLogin = IsLogin(this._userRepository.GetEntityList(), loginUserId);
            IList <AppChoicenessView> friendVideos = new List <AppChoicenessView>();

            if (isLogin)
            {
                //登录用户关注的用户
                var userFans = (from uf in this._userFansRepository.GetEntityList(CondtionEqualState())
                                join u in this._userRepository.GetEntityList(CondtionEqualState()) on uf.SubscribeUserId equals u.Id
                                where uf.CreateUserId == loginUserId
                                orderby uf.CreateTime descending
                                select uf).AsQueryable();
                if (userFans.Any())
                {
                    foreach (var userFan in userFans)
                    {
                        //获取关注的用户上传的最新视频的第一条
                        var userVideo = (from v in this._videoRepository.GetEntityList(CondtionEqualState())
                                         join u in this._userRepository.GetEntityList(CondtionEqualState()) on v.CreateManageId equals u.Id
                                         where u.Id == userFan.SubscribeUserId &&
                                         v.VideoState == 3 &&
                                         v.VideoSource
                                         orderby v.UpdateTime descending  //审核时间降序
                                         select new AppChoicenessView()
                        {
                            IsSubed = IsSubed(this._userFansRepository.GetEntityList(), u.Id, loginUserId),
                            IsCollect = IsCollect(this._userCollectRepository.GetEntityList(), (int)v.Id, loginUserId),
                            UserInfo = UserEasyView(u),
                            VideoInfo = VideoView(v),
                            Comments = ParentComments((int)v.Id)
                        }).FirstOrDefault();
                        if (userVideo != null)
                        {
                            friendVideos.Add(userVideo);
                        }
                    }
                }
            }

            #region  视频上传时间降序

            var friendVideosSort = (from v in friendVideos
                                    orderby v.VideoInfo.CreateTime descending //视频上传时间降序
                                    select v).AsQueryable();
            #endregion

            choicenesss.Choiceness = PageList(friendVideosSort, pageSize, pageIndex);
            return(choicenesss);
        }
Example #4
0
        /// <summary>
        /// 获取用户播放历史
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public AppChoicenesssView GetUserHistories(int userId, int pageIndex, int pageSize)
        {
            var choicenesss = new AppChoicenesssView {
                Choiceness = new List <AppChoicenessView>()
            };
            var userHistories    = _userHistoryRepository.GetEntityList(CondtionEqualUserId(userId));
            var choicenessVideos = (
                from uh in userHistories
                join v in _videoRepository.GetEntityList(CondtionEqualState()) on uh.VideoId equals v.Id
                join u in _userRepository.GetEntityList(CondtionEqualState()) on uh.UserId equals u.Id
                where v.VideoSource && v.VideoState == 3
                orderby uh.CreateTime descending
                select new AppChoicenessView
            {
                IsSubed = IsSubed(_userFansRepository.GetEntityList(), u.Id, userId),
                IsCollect = IsCollect(_userCollectRepository.GetEntityList(), (int)v.Id, userId),
                UserInfo = UserEasyView(u),
                VideoInfo = VideoView(v),
                Comments = ParentComments((int)v.Id)
            });

            choicenesss.Choiceness = PageList(choicenessVideos, pageSize, pageIndex);
            return(choicenesss);
        }