public ActionResult _ListActivities(string spaceKey, int?pageIndex, int?applicationId, MediaType?mediaType, bool?isOriginal, long?userId)
        {
            long        groupId = GroupIdToGroupKeyDictionary.GetGroupId(spaceKey);
            GroupEntity group   = groupService.Get(groupId);

            if (group == null)
            {
                return(new EmptyResult());
            }
            IUser currentUser = UserContext.CurrentUser;

            if (currentUser == null)
            {
                return(new EmptyResult());
            }
            PagingDataSet <Activity> activities = activityService.GetOwnerActivities(ActivityOwnerTypes.Instance().Group(), groupId, applicationId, mediaType, isOriginal, null, pageIndex ?? 1, userId);

            if (activities.FirstOrDefault() != null)
            {
                ViewData["lastActivityId"] = activities.FirstOrDefault().ActivityId;
            }
            bool isDynamic = groupService.IsDynamic(group.GroupId);
            bool isMember  = groupService.IsMember(group.GroupId, currentUser.UserId);

            ViewData["pageIndex"]     = pageIndex;
            ViewData["applicationId"] = applicationId;
            ViewData["mediaType"]     = mediaType;
            ViewData["isOriginal"]    = isOriginal;
            ViewData["userId"]        = userId;
            ViewData["isMember"]      = isMember;
            ViewData["isDynamic"]     = isDynamic;
            return(View(activities));
        }
Example #2
0
        /// <summary>
        /// 查询自lastActivityId以后又有多少动态进入用户的时间线
        /// </summary>
        /// <param name="ownerId">拥有者Id</param>
        /// <param name="lastActivityId">上次最后呈现的ActivityId</param>
        /// <param name="applicationId">应用Id</param>
        /// <param name="userId">返回首个动态操作者Id</param>
        /// <param name="ownerType">动态拥有者类型</param>
        /// <returns>自lastActivityId以后进入用户时间线的动态个数</returns>
        public int GetNewerCount(long ownerId, long lastActivityId, int?applicationId, out long userId, int?ownerType)
        {
            //根据lastActivityId获取到LastModified,获取晚于lastActivity.LastModified的动态并按LastModified倒排序
            string      cacheKey = GetCacheKey_NewerCount(ownerId, lastActivityId, applicationId, ownerType);
            List <long> userIds  = cacheService.Get <List <long> >(cacheKey);

            if (userIds == null)
            {
                Sql sql = Sql.Builder;
                sql.Select("A.UserId")
                .From("tn_Activities A");
                if (ownerType == ActivityOwnerTypes.Instance().User())
                {
                    sql.InnerJoin("tn_ActivityUserInbox AUI")
                    .On("A.ActivityId = AUI.ActivityId")
                    .Where("AUI.UserId = @0", ownerId)
                    .Where("A.UserId <> @0", ownerId);
                }
                else
                {
                    sql.Where("A.OwnerId = @0", ownerId)
                    .Where("A.OwnerType = @0", ownerType.Value);
                }
                sql.Where("A.LastModified > ( select LastModified from tn_Activities where ActivityId = @0 )", lastActivityId);
                if (applicationId.HasValue && applicationId.Value > 0)
                {
                    sql.Where("A.ApplicationId = @0", applicationId.Value);
                }
                sql.OrderBy("A.LastModified desc");
                userIds = CreateDAO().Fetch <long>(sql);
                cacheService.Add(cacheKey, userIds, CachingExpirationType.ObjectCollection);
            }
            userId = userIds.FirstOrDefault();
            return(userIds.Count);
        }
        /// <summary>
        /// 屏蔽用户/取消屏蔽时动态处理
        /// </summary>
        /// <param name="sender">关注实体</param>
        /// <param name="eventArgs">事件参数</param>
        void UserBlockedObjectActivityEventModule_After(UserBlockedObject sender, CommonEventArgs eventArgs)
        {
            int ownerType = -1;

            if (sender.ObjectType == BlockedObjectTypes.Instance().User())
            {
                ownerType = ActivityOwnerTypes.Instance().User();
            }
            else if (sender.ObjectType == BlockedObjectTypes.Instance().Group())
            {
                ownerType = ActivityOwnerTypes.Instance().Group();
            }
            else
            {
                return;
            }
            ActivityService activityService = new ActivityService();

            if (EventOperationType.Instance().Create() == eventArgs.EventOperationType)
            {
                activityService.RemoveInboxAboutOwner(sender.UserId, sender.ObjectId, ownerType);
            }
            else if (EventOperationType.Instance().Delete() == eventArgs.EventOperationType)
            {
                activityService.TraceBackInboxAboutOwner(sender.UserId, sender.ObjectId, ownerType);
            }
        }
Example #4
0
        /// <summary>
        /// 关注用户/取消关注动态处理
        /// </summary>
        /// <param name="sender">关注实体</param>
        /// <param name="eventArgs">事件参数</param>
        void FollowActivityEventModule_After(FollowEntity sender, CommonEventArgs eventArgs)
        {
            ActivityService activityService = new ActivityService();

            if (EventOperationType.Instance().Create() == eventArgs.EventOperationType)
            {
                UserService userService = new UserService();
                IUser       user        = userService.GetUser(sender.UserId);
                if (user == null)
                {
                    return;
                }

                Activity activity = Activity.New();

                activity.ActivityItemKey = ActivityItemKeys.Instance().FollowUser();
                activity.OwnerType       = ActivityOwnerTypes.Instance().User();
                activity.OwnerId         = sender.UserId;
                activity.OwnerName       = user.DisplayName;
                activity.UserId          = sender.UserId;
                activity.ReferenceId     = sender.FollowedUserId;
                activity.TenantTypeId    = TenantTypeIds.Instance().User();

                activityService.Generate(activity, false);

                activityService.TraceBackInboxAboutOwner(sender.UserId, sender.FollowedUserId, ActivityOwnerTypes.Instance().User());
            }
            else if (EventOperationType.Instance().Delete() == eventArgs.EventOperationType)
            {
                activityService.RemoveInboxAboutOwner(sender.UserId, sender.FollowedUserId, ActivityOwnerTypes.Instance().User());
            }
        }
Example #5
0
        /// <summary>
        /// 查询自lastActivityId以后进入用户时间线的动态
        /// </summary>
        /// <param name="ownerId">拥有者Id</param>
        /// <param name="lastActivityId">上次最后呈现的ActivityId</param>
        /// <param name="applicationId">应用Id</param>
        /// <param name="ownerType">动态拥有者类型</param>
        /// <returns>lastActivityId</returns>
        public IEnumerable <Activity> GetNewerActivities(long ownerId, long lastActivityId, int?applicationId, int?ownerType)
        {
            //根据lastActivityId获取到LastModified,获取晚于lastActivity.LastModified的动态并按LastModified倒排序
            Sql sql = Sql.Builder;

            sql.Select("A.*")
            .From("tn_Activities A");
            if (ownerType == ActivityOwnerTypes.Instance().User())
            {
                sql.InnerJoin("tn_ActivityUserInbox AUI")
                .On("A.ActivityId = AUI.ActivityId")
                .Where("AUI.UserId=@0", ownerId);
            }
            else
            {
                sql.Where("A.OwnerId=@0", ownerId).Where("A.OwnerType=@0", ownerType.Value);
            }
            sql.Where("A.LastModified > ( select LastModified from tn_Activities where ActivityId=@0 )", lastActivityId);
            if (applicationId.HasValue && applicationId.Value > 0)
            {
                sql.Where("A.ApplicationId=@0", applicationId.Value);
            }
            sql.OrderBy("A.LastModified desc");
            return(CreateDAO().Fetch <Activity>(sql));
        }
Example #6
0
        /// <summary>
        /// 动态处理程序
        /// </summary>
        /// <param name="groupMember"></param>
        /// <param name="eventArgs"></param>
        private void TopicMemberActivityModule_After(TopicMember groupMember, CommonEventArgs eventArgs)
        {
            ActivityService activityService = new ActivityService();

            if (eventArgs.EventOperationType == EventOperationType.Instance().Create())
            {
                //生成动态
                if (groupMember == null)
                {
                    return;
                }
                var group = new TopicService().Get(groupMember.TopicId);
                if (group == null)
                {
                    return;
                }
                //生成Owner为专题的动态
                Activity actvityOfTopic = Activity.New();
                actvityOfTopic.ActivityItemKey       = ActivityItemKeys.Instance().CreateTopicMember();
                actvityOfTopic.ApplicationId         = TopicConfig.Instance().ApplicationId;
                actvityOfTopic.IsOriginalThread      = true;
                actvityOfTopic.IsPrivate             = !group.IsPublic;
                actvityOfTopic.UserId                = groupMember.UserId;
                actvityOfTopic.ReferenceId           = 0;
                actvityOfTopic.ReferenceTenantTypeId = string.Empty;
                actvityOfTopic.SourceId              = groupMember.Id;
                actvityOfTopic.TenantTypeId          = TenantTypeIds.Instance().User();
                actvityOfTopic.OwnerId               = group.TopicId;
                actvityOfTopic.OwnerName             = group.TopicName;
                actvityOfTopic.OwnerType             = ActivityOwnerTypes.Instance().Topic();

                activityService.Generate(actvityOfTopic, false);

                //生成Owner为用户的动态
                Activity actvityOfUser = Activity.New();
                actvityOfUser.ActivityItemKey        = ActivityItemKeys.Instance().JoinTopic();
                actvityOfUser.ApplicationId          = actvityOfTopic.ApplicationId;
                actvityOfUser.HasImage               = actvityOfTopic.HasImage;
                actvityOfUser.HasMusic               = actvityOfTopic.HasMusic;
                actvityOfUser.HasVideo               = actvityOfTopic.HasVideo;
                actvityOfUser.IsOriginalThread       = actvityOfTopic.IsOriginalThread;
                actvityOfUser.IsPrivate              = actvityOfTopic.IsPrivate;
                actvityOfUser.UserId                 = actvityOfTopic.UserId;
                actvityOfUser.ReferenceId            = actvityOfTopic.ReferenceId;
                actvityOfTopic.ReferenceTenantTypeId = actvityOfTopic.ReferenceTenantTypeId;
                actvityOfUser.SourceId               = actvityOfTopic.SourceId;

                actvityOfUser.TenantTypeId = actvityOfTopic.TenantTypeId;
                actvityOfUser.OwnerId      = groupMember.UserId;
                actvityOfUser.OwnerName    = groupMember.User.DisplayName;
                actvityOfUser.OwnerType    = ActivityOwnerTypes.Instance().User();
                activityService.Generate(actvityOfUser, false);
            }
            else if (eventArgs.EventOperationType == EventOperationType.Instance().Delete()) //删除动态
            {
                activityService.DeleteSource(TenantTypeIds.Instance().User(), groupMember.UserId);
            }
        }
Example #7
0
        /// <summary>
        /// 动态处理程序
        /// </summary>
        /// <param name="groupMember"></param>
        /// <param name="eventArgs"></param>
        private void GroupMemberActivityModule_After(GroupMember groupMember, CommonEventArgs eventArgs)
        {
            ActivityService activityService = new ActivityService();

            if (eventArgs.EventOperationType == EventOperationType.Instance().Create())
            {
                //生成动态
                if (groupMember == null)
                {
                    return;
                }
                var group = new GroupService().Get(groupMember.GroupId);
                if (group == null)
                {
                    return;
                }
                //生成Owner为群组的动态
                Activity actvityOfGroup = Activity.New();
                actvityOfGroup.ActivityItemKey       = ActivityItemKeys.Instance().CreateGroupMember();
                actvityOfGroup.ApplicationId         = GroupConfig.Instance().ApplicationId;
                actvityOfGroup.IsOriginalThread      = true;
                actvityOfGroup.IsPrivate             = !group.IsPublic;
                actvityOfGroup.UserId                = groupMember.UserId;
                actvityOfGroup.ReferenceId           = group.GroupId;
                actvityOfGroup.ReferenceTenantTypeId = TenantTypeIds.Instance().Group();
                actvityOfGroup.SourceId              = groupMember.UserId;
                actvityOfGroup.TenantTypeId          = TenantTypeIds.Instance().User();
                actvityOfGroup.OwnerId               = group.GroupId;
                actvityOfGroup.OwnerName             = group.GroupName;
                actvityOfGroup.OwnerType             = ActivityOwnerTypes.Instance().Group();

                activityService.Generate(actvityOfGroup, false);

                //生成Owner为用户的动态
                Activity actvityOfUser = Activity.New();
                actvityOfUser.ActivityItemKey        = ActivityItemKeys.Instance().JoinGroup();
                actvityOfUser.ApplicationId          = actvityOfGroup.ApplicationId;
                actvityOfUser.HasImage               = actvityOfGroup.HasImage;
                actvityOfUser.HasMusic               = actvityOfGroup.HasMusic;
                actvityOfUser.HasVideo               = actvityOfGroup.HasVideo;
                actvityOfUser.IsOriginalThread       = actvityOfGroup.IsOriginalThread;
                actvityOfUser.IsPrivate              = actvityOfGroup.IsPrivate;
                actvityOfUser.UserId                 = actvityOfGroup.UserId;
                actvityOfUser.ReferenceId            = actvityOfGroup.ReferenceId;
                actvityOfGroup.ReferenceTenantTypeId = actvityOfGroup.ReferenceTenantTypeId;
                actvityOfUser.SourceId               = actvityOfGroup.SourceId;

                actvityOfUser.TenantTypeId = actvityOfGroup.TenantTypeId;
                actvityOfUser.OwnerId      = groupMember.UserId;
                actvityOfUser.OwnerName    = groupMember.User.DisplayName;
                actvityOfUser.OwnerType    = ActivityOwnerTypes.Instance().User();
                activityService.Generate(actvityOfUser, false);
            }
            else if (eventArgs.EventOperationType == EventOperationType.Instance().Delete()) //删除动态
            {
                activityService.DeleteSource(TenantTypeIds.Instance().User(), groupMember.UserId);
            }
        }
Example #8
0
        /// <summary>
        /// 兑换商品时处理积分,动态
        /// </summary>
        /// <param name="record">兑换申请</param>
        /// <param name="eventArgs"></param>
        public void RecordAcitivityEventModule_After(PointGiftExchangeRecord record, CommonEventArgs eventArgs)
        {
            //生成动态
            ActivityService activityService = new ActivityService();

            if (eventArgs.EventOperationType == EventOperationType.Instance().Approved())
            {
                //初始化Owner为用户的动态
                Activity activity = Activity.New();
                activity.ActivityItemKey       = ActivityItemKeys.Instance().ExchangeGift();
                activity.ApplicationId         = PointMallConfig.Instance().ApplicationId;
                activity.HasImage              = true;
                activity.HasMusic              = false;
                activity.HasVideo              = false;
                activity.IsOriginalThread      = true;
                activity.IsPrivate             = false;
                activity.UserId                = record.PayerUserId;
                activity.ReferenceId           = record.GiftId;
                activity.ReferenceTenantTypeId = TenantTypeIds.Instance().PointGift();
                activity.SourceId              = record.RecordId;
                activity.TenantTypeId          = TenantTypeIds.Instance().PointGiftExchangeRecord();
                activity.OwnerId               = record.PayerUserId;
                activity.OwnerName             = record.Payer;
                activity.OwnerType             = ActivityOwnerTypes.Instance().User();

                activityService.Generate(activity, true);

                //通知
                Notice notice = Notice.New();
                notice.UserId             = record.PayerUserId;
                notice.ApplicationId      = PointMallConfig.Instance().ApplicationId;
                notice.TypeId             = NoticeTypeIds.Instance().Hint();
                notice.LeadingActor       = record.Payer;
                notice.LeadingActorUrl    = SiteUrls.FullUrl(SiteUrls.Instance().SpaceHome(record.PayerUserId));
                notice.RelativeObjectName = record.GiftName;
                notice.RelativeObjectUrl  = SiteUrls.FullUrl(SiteUrls.Instance().GiftDetail(record.GiftId));
                notice.TemplateName       = NoticeTemplateNames.Instance().ApplyRecord();
                noticeService.Create(notice);
            }
            else if (eventArgs.EventOperationType == EventOperationType.Instance().Disapproved())
            {
                //通知
                Notice notice = Notice.New();
                notice.UserId             = record.PayerUserId;
                notice.ApplicationId      = PointMallConfig.Instance().ApplicationId;
                notice.TypeId             = NoticeTypeIds.Instance().Hint();
                notice.LeadingActor       = record.Payer;
                notice.LeadingActorUrl    = SiteUrls.FullUrl(SiteUrls.Instance().SpaceHome(record.PayerUserId));
                notice.RelativeObjectName = record.GiftName;
                notice.RelativeObjectUrl  = SiteUrls.FullUrl(SiteUrls.Instance().GiftDetail(record.GiftId));
                notice.TemplateName       = NoticeTemplateNames.Instance().CancelRecord();
                noticeService.Create(notice);
            }
        }
Example #9
0
        /// <summary>
        /// 获取新动态数量缓存Key
        /// </summary>
        /// <param name="ownerId"></param>
        /// <param name="lastActivityId"></param>
        /// <param name="applicationId"></param>
        /// <returns></returns>
        private string GetCacheKey_NewerCount(long ownerId, long lastActivityId, int?applicationId, int?ownerType)
        {
            StringBuilder cacheKey = new StringBuilder(RealTimeCacheHelper.GetListCacheKeyPrefix(CacheVersionType.AreaVersion, "OwnerId", ownerId));

            cacheKey.AppendFormat("ActivityNewerCount::UserId-{0}:LastActivityId-{1}:ApplicationId-{2}", ownerId, lastActivityId, applicationId);
            if (ownerType != ActivityOwnerTypes.Instance().User())
            {
                cacheKey.AppendFormat("OwnerType-{0}", ownerType);
            }
            return(cacheKey.ToString());
        }
Example #10
0
        public ActionResult _NewGroupActivities(string spaceKey)
        {
            long groupId = GroupIdToGroupKeyDictionary.GetGroupId(spaceKey);
            PagingDataSet <Activity> activities = activityService.GetOwnerActivities(ActivityOwnerTypes.Instance().Group(), groupId, 1001, null, null, null, 1, null);

            if (activities != null)
            {
                return(View(activities.FirstOrDefault()));
            }
            return(View());
        }
Example #11
0
        /// <summary>
        /// 动态处理程序
        /// </summary>
        /// <param name="blogThread"></param>
        /// <param name="eventArgs"></param>
        private void BlogThreadActivityModule_After(BlogThread blogThread, AuditEventArgs eventArgs)
        {
            //生成动态
            ActivityService activityService = new ActivityService();
            AuditService    auditService    = new AuditService();

            bool?auditDirection = auditService.ResolveAuditDirection(eventArgs.OldAuditStatus, eventArgs.NewAuditStatus);

            if (auditDirection == true)
            {
                //初始化Owner为用户的动态
                Activity activityOfUser = Activity.New();
                activityOfUser.ActivityItemKey = ActivityItemKeys.Instance().CreateBlogThread();
                activityOfUser.ApplicationId   = BlogConfig.Instance().ApplicationId;

                //判断是否有图片、音频、视频
                AttachmentService        attachmentService = new AttachmentService(TenantTypeIds.Instance().BlogThread());
                IEnumerable <Attachment> attachments       = attachmentService.GetsByAssociateId(blogThread.ThreadId);
                if (attachments != null && attachments.Any(n => n.MediaType == MediaType.Image))
                {
                    activityOfUser.HasImage = true;
                }

                activityOfUser.HasMusic              = false;
                activityOfUser.HasVideo              = false;
                activityOfUser.IsOriginalThread      = !blogThread.IsReproduced;
                activityOfUser.IsPrivate             = blogThread.PrivacyStatus == PrivacyStatus.Private ? true : false;
                activityOfUser.UserId                = blogThread.UserId;
                activityOfUser.ReferenceId           = 0;
                activityOfUser.ReferenceTenantTypeId = string.Empty;
                activityOfUser.SourceId              = blogThread.ThreadId;
                activityOfUser.TenantTypeId          = TenantTypeIds.Instance().BlogThread();
                activityOfUser.OwnerId               = blogThread.UserId;
                activityOfUser.OwnerName             = blogThread.Author;
                activityOfUser.OwnerType             = ActivityOwnerTypes.Instance().User();

                //是否是公开的(用于是否推送站点动态)
                bool isPublic = blogThread.PrivacyStatus == PrivacyStatus.Public ? true : false;

                //生成动态
                activityService.Generate(activityOfUser, true, isPublic);
            }
            //删除动态
            else if (auditDirection == false)
            {
                activityService.DeleteSource(TenantTypeIds.Instance().BlogThread(), blogThread.ThreadId);
            }
        }
Example #12
0
        public ActionResult _ListActivities(string spaceKey, int?pageIndex, int?applicationId, MediaType?mediaType, bool?isOriginal, long?userId)
        {
            long groupId = GroupIdToGroupKeyDictionary.GetGroupId(spaceKey);
            PagingDataSet <Activity> activities = activityService.GetOwnerActivities(ActivityOwnerTypes.Instance().Group(), groupId, applicationId, mediaType, isOriginal, null, pageIndex ?? 1, userId);

            if (activities.FirstOrDefault() != null)
            {
                ViewData["lastActivityId"] = activities.FirstOrDefault().ActivityId;
            }
            ViewData["pageIndex"]     = pageIndex;
            ViewData["applicationId"] = applicationId;
            ViewData["mediaType"]     = mediaType;
            ViewData["isOriginal"]    = isOriginal;
            ViewData["userId"]        = userId;
            return(View(activities));
        }
Example #13
0
        /// <summary>
        /// 评论资讯动态处理程序
        /// </summary>
        /// <param name="comment"></param>
        /// <param name="eventArgs"></param>
        private void CmsCommentActivityEventModule_After(Comment comment, AuditEventArgs eventArgs)
        {
            NoticeService noticeService = new NoticeService();
            ContentItem   contentItem   = null;

            if (comment.TenantTypeId == TenantTypeIds.Instance().ContentItem())
            {
                //生成动态
                ActivityService activityService = new ActivityService();
                AuditService    auditService    = new AuditService();
                bool?           auditDirection  = auditService.ResolveAuditDirection(eventArgs.OldAuditStatus, eventArgs.NewAuditStatus);
                if (auditDirection == true)
                {
                    //创建评论的动态[关注评论者的粉丝可以看到该评论]
                    Activity activity = Activity.New();
                    activity.ActivityItemKey = ActivityItemKeys.Instance().CreateCmsComment();
                    activity.ApplicationId   = CmsConfig.Instance().ApplicationId;

                    ContentItemService contentItemService = new ContentItemService();
                    contentItem = contentItemService.Get(comment.CommentedObjectId);
                    if (contentItem == null || contentItem.UserId == comment.UserId)
                    {
                        return;
                    }
                    activity.IsOriginalThread      = true;
                    activity.IsPrivate             = false;
                    activity.OwnerId               = comment.UserId;
                    activity.OwnerName             = comment.Author;
                    activity.OwnerType             = ActivityOwnerTypes.Instance().User();
                    activity.ReferenceId           = contentItem.ContentItemId;
                    activity.ReferenceTenantTypeId = TenantTypeIds.Instance().ContentItem();
                    activity.SourceId              = comment.Id;
                    activity.TenantTypeId          = TenantTypeIds.Instance().Comment();
                    activity.UserId = comment.UserId;

                    activityService.Generate(activity, false);
                }
                else if (auditDirection == false)
                {
                    activityService.DeleteSource(TenantTypeIds.Instance().Comment(), comment.Id);
                }
            }
        }
Example #14
0
        /// <summary>
        /// 动态处理程序
        /// </summary>
        private void PhotoActivityModule_After(Album album, AuditEventArgs eventArgs)
        {
            //生成动态
            ActivityService activityService = new ActivityService();
            AuditService    auditService    = new AuditService();

            bool?auditDirection = auditService.ResolveAuditDirection(eventArgs.OldAuditStatus, eventArgs.NewAuditStatus);

            if (auditDirection == true)
            {
                //如果是新上传了照片,则更新最后修改时间
                if (activityService.UpdateLastModified(TenantTypeIds.Instance().Album(), album.AlbumId))
                {
                    return;
                }
                //初始化Owner为用户的动态
                Activity activity = Activity.New();
                activity.ActivityItemKey       = ActivityItemKeys.Instance().CreatePhoto();
                activity.ApplicationId         = PhotoConfig.Instance().ApplicationId;
                activity.HasImage              = true;
                activity.HasMusic              = false;
                activity.HasVideo              = false;
                activity.IsOriginalThread      = true;
                activity.IsPrivate             = album.PrivacyStatus == PrivacyStatus.Private ? true : false;
                activity.UserId                = album.UserId;
                activity.ReferenceId           = 0;
                activity.ReferenceTenantTypeId = string.Empty;
                activity.SourceId              = album.AlbumId;
                activity.TenantTypeId          = TenantTypeIds.Instance().Album();
                activity.OwnerId               = album.UserId;
                activity.OwnerName             = album.Author;
                activity.OwnerType             = ActivityOwnerTypes.Instance().User();
                //是否是公开的(用于是否推送站点动态)
                bool isPublic = album.PrivacyStatus == PrivacyStatus.Public ? true : false;

                activityService.Generate(activity, true, isPublic);
            }
            else if (auditDirection == false) //删除动态
            {
                activityService.DeleteSource(TenantTypeIds.Instance().Album(), album.AlbumId);
            }
        }
Example #15
0
        /// <summary>
        /// 评论动态处理
        /// </summary>
        /// <param name="comment"></param>
        /// <param name="eventArgs"></param>
        private void CommentActivityEventModule_After(Comment comment, AuditEventArgs eventArgs)
        {
            bool? auditDirection = auditService.ResolveAuditDirection(eventArgs.OldAuditStatus, eventArgs.NewAuditStatus);
            Photo photo          = null;

            if (comment.TenantTypeId == TenantTypeIds.Instance().Photo() && comment.UserId != comment.ToUserId)
            {
                if (auditDirection == true)
                {
                    photo = photoService.GetPhoto(comment.CommentedObjectId);
                    Activity activityOfFollower = Activity.New();
                    activityOfFollower.ActivityItemKey       = ActivityItemKeys.Instance().CommentPhoto();
                    activityOfFollower.ApplicationId         = PhotoConfig.Instance().ApplicationId;
                    activityOfFollower.HasImage              = false;
                    activityOfFollower.HasMusic              = false;
                    activityOfFollower.HasVideo              = false;
                    activityOfFollower.IsOriginalThread      = true;
                    activityOfFollower.IsPrivate             = photo.PrivacyStatus == PrivacyStatus.Private ? true : false;
                    activityOfFollower.UserId                = comment.UserId;
                    activityOfFollower.ReferenceId           = photo.PhotoId;
                    activityOfFollower.ReferenceTenantTypeId = TenantTypeIds.Instance().Photo();
                    activityOfFollower.SourceId              = comment.Id;
                    activityOfFollower.TenantTypeId          = TenantTypeIds.Instance().Comment();
                    activityOfFollower.OwnerId               = comment.UserId;
                    activityOfFollower.OwnerName             = comment.Author;
                    activityOfFollower.OwnerType             = ActivityOwnerTypes.Instance().User();

                    //是否是公开的(用于是否推送站点动态)
                    bool isPublic = photo.PrivacyStatus == PrivacyStatus.Public ? true : false;

                    activityService.Generate(activityOfFollower, true, isPublic);
                }
                else
                {
                    activityService.DeleteSource(TenantTypeIds.Instance().Comment(), comment.Id);
                }
            }
        }
Example #16
0
        /// <summary>
        /// 关注帖吧事件处理程序
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="eventArgs"></param>
        void SubscribeBarSectionEventModule_After(long sender, SubscribeEventArgs eventArgs)
        {
            if (eventArgs.TenantTypeId != TenantTypeIds.Instance().BarSection())
            {
                return;
            }
            ActivityService activityService = new ActivityService();

            if (EventOperationType.Instance().Create() == eventArgs.EventOperationType)
            {
                activityService.TraceBackInboxAboutOwner(eventArgs.UserId, sender, ActivityOwnerTypes.Instance().BarSection());
                //用户内容计数
                OwnerDataService ownerDataService = new OwnerDataService(TenantTypeIds.Instance().User());
                ownerDataService.Change(eventArgs.UserId, OwnerDataKeys.Instance().FollowSectionCount(), 1);
            }
            else if (EventOperationType.Instance().Delete() == eventArgs.EventOperationType)
            {
                activityService.RemoveInboxAboutOwner(eventArgs.UserId, sender, ActivityOwnerTypes.Instance().BarSection());
                //用户内容计数
                OwnerDataService ownerDataService = new OwnerDataService(TenantTypeIds.Instance().User());
                ownerDataService.Change(eventArgs.UserId, OwnerDataKeys.Instance().FollowSectionCount(), -1);
            }
        }
Example #17
0
        /// <summary>
        /// 圈人动态处理
        /// </summary>
        private void LabelPhotoActivityModule_After(PhotoLabel photoLabel, CommonEventArgs eventArgs)
        {
            Photo photo = photoService.GetPhoto(photoLabel.PhotoId);

            if (eventArgs.EventOperationType == EventOperationType.Instance().Create())
            {
                //初始化Owner为用户的动态
                Activity activity = Activity.New();
                activity.ActivityItemKey       = ActivityItemKeys.Instance().LabelPhoto();
                activity.ApplicationId         = PhotoConfig.Instance().ApplicationId;
                activity.HasImage              = true;
                activity.HasMusic              = false;
                activity.HasVideo              = false;
                activity.IsOriginalThread      = true;
                activity.IsPrivate             = photoLabel.Photo.PrivacyStatus == PrivacyStatus.Private ? true : false;
                activity.UserId                = photo.UserId;
                activity.ReferenceId           = photoLabel.PhotoId;
                activity.ReferenceTenantTypeId = TenantTypeIds.Instance().Photo();
                activity.SourceId              = photoLabel.LabelId;
                activity.TenantTypeId          = TenantTypeIds.Instance().PhotoLabel();
                activity.OwnerId               = photo.UserId;
                activity.OwnerName             = photo.Author;
                activity.OwnerType             = ActivityOwnerTypes.Instance().User();

                //是否是公开的(用于是否推送站点动态)
                bool isPublic = photoLabel.Photo.PrivacyStatus == PrivacyStatus.Public ? true : false;

                activityService.Generate(activity, true, isPublic);

                //再为被圈用户生成动态
                new ActivityRepository().InsertUserInboxs(activity.ActivityId, new long[] { photoLabel.ObjetId });
            }
            else
            {
                activityService.DeleteSource(TenantTypeIds.Instance().PhotoLabel(), photoLabel.LabelId);
            }
        }
Example #18
0
        /// <summary>
        /// 动态处理程序
        /// </summary>
        /// <param name="group"></param>
        /// <param name="eventArgs"></param>
        private void GroupEntityActivityModule_After(GroupEntity group, AuditEventArgs eventArgs)
        {
            //生成动态
            ActivityService activityService = new ActivityService();
            AuditService    auditService    = new AuditService();
            bool?           auditDirection  = auditService.ResolveAuditDirection(eventArgs.OldAuditStatus, eventArgs.NewAuditStatus);

            if (auditDirection == true) //生成动态
            {
                if (group == null)
                {
                    return;
                }

                //生成Owner为用户的动态
                Activity actvityOfBar = Activity.New();
                actvityOfBar.ActivityItemKey       = ActivityItemKeys.Instance().CreateGroup();
                actvityOfBar.ApplicationId         = GroupConfig.Instance().ApplicationId;
                actvityOfBar.IsOriginalThread      = true;
                actvityOfBar.IsPrivate             = !group.IsPublic;
                actvityOfBar.UserId                = group.UserId;
                actvityOfBar.ReferenceId           = 0;//没有涉及到的实体
                actvityOfBar.ReferenceTenantTypeId = string.Empty;
                actvityOfBar.SourceId              = group.GroupId;
                actvityOfBar.TenantTypeId          = TenantTypeIds.Instance().Group();
                actvityOfBar.OwnerId               = group.UserId;
                actvityOfBar.OwnerName             = group.User.DisplayName;
                actvityOfBar.OwnerType             = ActivityOwnerTypes.Instance().User();

                activityService.Generate(actvityOfBar, true);
            }
            else if (auditDirection == false) //删除动态
            {
                activityService.DeleteSource(TenantTypeIds.Instance().Group(), group.GroupId);
            }
        }
Example #19
0
        /// <summary>
        /// 应用初始化
        /// </summary>
        /// <param name="containerBuilder">容器构建器</param>
        public override void Initialize(ContainerBuilder containerBuilder)
        {
            //注册ResourceAccessor的应用资源
            ResourceAccessor.RegisterApplicationResourceManager(ApplicationId, "Spacebuilder.Blog.Resources.Resource", typeof(Spacebuilder.Blog.Resources.Resource).Assembly);

            //注册附件设置
            TenantAttachmentSettings.RegisterSettings(tenantAttachmentSettingsElement);
            TenantCommentSettings.RegisterSettings(tenantCommentSettingsElement);

            //注册日志正文解析器
            containerBuilder.Register(c => new BlogBodyProcessor()).Named <IBodyProcessor>(TenantTypeIds.Instance().Blog()).SingleInstance();

            //注册EventModule
            containerBuilder.Register(c => new BlogActivityReceiverGetter()).Named <IActivityReceiverGetter>(ActivityOwnerTypes.Instance().Blog().ToString()).SingleInstance();

            //注册全文检索搜索器
            containerBuilder.Register(c => new BlogSearcher("日志", "~/App_Data/IndexFiles/Blog", true, 3)).As <ISearcher>().Named <ISearcher>(BlogSearcher.CODE).SingleInstance();

            //日志应用数据统计
            containerBuilder.Register(c => new BlogApplicationStatisticDataGetter()).Named <IApplicationStatisticDataGetter>(this.ApplicationKey).SingleInstance();
        }
        /// <summary>
        /// 获取以后进入用户时间线的动态
        /// </summary>
        public ActionResult _GetNewerActivities(string spaceKey, int?applicationId, long?lastActivityId = 0)
        {
            if (UserContext.CurrentUser == null)
            {
                return(new EmptyResult());
            }
            long groupId = GroupIdToGroupKeyDictionary.GetGroupId(spaceKey);
            IEnumerable <Activity> newActivities = activityService.GetNewerActivities(groupId, lastActivityId.Value, applicationId, ActivityOwnerTypes.Instance().Group(), UserContext.CurrentUser.UserId);

            if (newActivities != null && newActivities.Count() > 0)
            {
                ViewData["lastActivityId"] = newActivities.FirstOrDefault().ActivityId;
            }
            return(View(newActivities));
        }
Example #21
0
        /// <summary>
        /// 评论日志动态处理程序
        /// </summary>
        /// <param name="comment"></param>
        /// <param name="eventArgs"></param>
        private void BlogCommentActivityEventModule_After(Comment comment, AuditEventArgs eventArgs)
        {
            NoticeService noticeService = new NoticeService();
            BlogThread    blogThread    = null;

            if (comment.TenantTypeId == TenantTypeIds.Instance().BlogThread())
            {
                //生成动态
                ActivityService activityService = new ActivityService();
                AuditService    auditService    = new AuditService();
                bool?           auditDirection  = auditService.ResolveAuditDirection(eventArgs.OldAuditStatus, eventArgs.NewAuditStatus);
                if (auditDirection == true)
                {
                    //创建评论的动态[关注评论者的粉丝可以看到该评论]
                    Activity activity = Activity.New();
                    activity.ActivityItemKey = ActivityItemKeys.Instance().CreateBlogComment();
                    activity.ApplicationId   = BlogConfig.Instance().ApplicationId;

                    BlogService blogService = new BlogService();
                    blogThread = blogService.Get(comment.CommentedObjectId);
                    if (blogThread == null || blogThread.UserId == comment.UserId)
                    {
                        return;
                    }
                    activity.IsOriginalThread      = true;
                    activity.IsPrivate             = false;
                    activity.OwnerId               = comment.UserId;
                    activity.OwnerName             = comment.Author;
                    activity.OwnerType             = ActivityOwnerTypes.Instance().User();
                    activity.ReferenceId           = blogThread.ThreadId;
                    activity.ReferenceTenantTypeId = TenantTypeIds.Instance().BlogThread();
                    activity.SourceId              = comment.Id;
                    activity.TenantTypeId          = TenantTypeIds.Instance().Comment();
                    activity.UserId = comment.UserId;

                    //是否是公开的(用于是否推送站点动态)
                    bool isPublic = blogThread.PrivacyStatus == PrivacyStatus.Public ? true : false;
                    activityService.Generate(activity, false, isPublic);

                    //创建评论的动态[关注该日志的用户可以看到该评论]
                    Activity activityOfBlogComment = Activity.New();
                    activityOfBlogComment.ActivityItemKey       = activity.ActivityItemKey;
                    activityOfBlogComment.ApplicationId         = activity.ApplicationId;
                    activityOfBlogComment.IsOriginalThread      = activity.IsOriginalThread;
                    activityOfBlogComment.IsPrivate             = activity.IsPrivate;
                    activityOfBlogComment.ReferenceId           = activity.ReferenceId;
                    activityOfBlogComment.ReferenceTenantTypeId = activity.ReferenceTenantTypeId;
                    activityOfBlogComment.SourceId     = activity.SourceId;
                    activityOfBlogComment.TenantTypeId = activity.TenantTypeId;
                    activityOfBlogComment.UserId       = activity.UserId;

                    activityOfBlogComment.OwnerId   = blogThread.ThreadId;
                    activityOfBlogComment.OwnerName = blogThread.ResolvedSubject;
                    activityOfBlogComment.OwnerType = ActivityOwnerTypes.Instance().Blog();

                    activityService.Generate(activityOfBlogComment, false, isPublic);
                }
                else if (auditDirection == false)
                {
                    activityService.DeleteSource(TenantTypeIds.Instance().Comment(), comment.Id);
                }
            }
        }
Example #22
0
 /// <summary>
 /// 问答(标签)
 /// </summary>
 public static int AskTag(this ActivityOwnerTypes ActivityOwnerTypes)
 {
     return(1303);
 }
Example #23
0
 /// <summary>
 /// 帖吧
 /// </summary>
 public static int BarSection(this ActivityOwnerTypes ActivityOwnerTypes)
 {
     return(12);
 }
Example #24
0
        /// <summary>
        /// 获取用户的时间线
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="followGroupId"><para>关注用户分组Id</para><remarks>groupId为-1时获取相互关注的用户,为null时获取所有用户</remarks></param>
        /// <param name="applicationId">应用Id</param>
        /// <param name="mediaType"><see cref="MediaType"/></param>
        /// <param name="isOriginalThread">是不是原创主题</param>
        /// <param name="pageIndex">页码</param>
        ///<returns></returns>
        public PagingDataSet <Activity> GetMyTimeline(long userId, long?followGroupId, int?applicationId, MediaType?mediaType, bool?isOriginalThread, int pageIndex)
        {
            //按tn_Activities的LastModified倒排序
            return(GetPagingEntities(pageSize, pageIndex, CachingExpirationType.ObjectCollection, () =>
            {
                StringBuilder cacheKey = new StringBuilder(RealTimeCacheHelper.GetListCacheKeyPrefix(CacheVersionType.AreaVersion, "UserId", userId));
                cacheKey.Append("MyTimeline::");
                cacheKey.AppendFormat("UserId-{0}:", userId);
                if (followGroupId.HasValue)
                {
                    cacheKey.AppendFormat("FollowGroupId-{0}:", followGroupId.Value);
                }
                if (applicationId.HasValue && applicationId.Value > 0)
                {
                    cacheKey.AppendFormat("ApplicationId-{0}:", applicationId.Value);
                }
                if (mediaType.HasValue)
                {
                    cacheKey.AppendFormat("MediaType-{0}:", (int)mediaType.Value);
                }
                if (isOriginalThread.HasValue)
                {
                    cacheKey.AppendFormat("IsOriginalThread-{0}", isOriginalThread.Value);
                }
                return cacheKey.ToString();
            }, () =>
            {
                Sql sql = Sql.Builder;
                sql.From("tn_Activities")
                .InnerJoin("tn_ActivityUserInbox AUI")
                .On("tn_Activities.ActivityId = AUI.ActivityId")
                .Where("AUI.UserId=@0", userId);

                //done:zhengw,by mazq 相互关注怎么处理的?
                //zhengw回复:已修改
                //mazq回复:相互关注、悄悄关注 followGroupId.Value都是大于0的
                //zhengw回复:已删除判断followGroupId.Value>0
                if (followGroupId.HasValue)
                {
                    //sql.Where("tn_Activities.OwnerType=@0", ActivityOwnerTypes.Instance().User());
                    if (followGroupId.Value == FollowSpecifyGroupIds.Quietly)
                    {
                        sql.Where(@"tn_Activities.OwnerId in ( select FollowedUserId from tn_Follows where IsQuietly = 1 and UserId= @0)", userId);
                    }
                    else if (followGroupId.Value == FollowSpecifyGroupIds.Mutual)
                    {
                        sql.Where(@"tn_Activities.OwnerId in ( select FollowedUserId from tn_Follows where IsMutual = 1 and UserId= @0)", userId);
                    }
                    else if (followGroupId.Value > 0)
                    {
                        sql.Where("tn_Activities.OwnerType=@0", ActivityOwnerTypes.Instance().User())
                        .Where(@"tn_Activities.OwnerId in ( select F.FollowedUserId 
                                            from tn_Follows F inner join tn_ItemsInCategories IIC  on F.Id = IIC.ItemId 
                                            where F.UserId=@0 and IIC.CategoryId=@1 )", userId, followGroupId.Value);
                    }
                }

                if (applicationId.HasValue && applicationId.Value > 0)
                {
                    sql.Where("tn_Activities.ApplicationId=@0", applicationId.Value);
                }
                if (mediaType.HasValue)
                {
                    switch (mediaType)
                    {
                    case MediaType.Audio:
                        sql.Where("tn_Activities.HasMusic=1");
                        break;

                    case MediaType.Image:
                        sql.Where("tn_Activities.HasImage=1");
                        break;

                    case MediaType.Video:
                        sql.Where("tn_Activities.HasVideo=1");
                        break;
                    }
                }
                if (isOriginalThread.HasValue)
                {
                    sql.Where("tn_Activities.IsOriginalThread=@0", isOriginalThread.Value);
                }
                sql.OrderBy("tn_Activities.LastModified desc");
                return sql;
            }));
        }
Example #25
0
        public JsonResult GetNewerGroupActivityCount(string spaceKey, long lastActivityId, int?applicationId)
        {
            long   groupId = GroupIdToGroupKeyDictionary.GetGroupId(spaceKey);
            string name;
            int    count = activityService.GetNewerCount(groupId, lastActivityId, applicationId, out name, ActivityOwnerTypes.Instance().Group());

            if (count == 0)
            {
                return(Json(new JsonResult {
                    Data = new { lastActivityId = lastActivityId, hasNew = false }
                }));
            }
            else
            {
                string showName;
                if (count == 1)
                {
                    showName = name + "更新了动态,点击查看";
                }
                else
                {
                    showName = name + "等多位群友更新了动态,点击查看";
                }
                return(Json(new JsonResult {
                    Data = new { hasNew = true, showName = showName }
                }));
            }
        }
Example #26
0
 /// <summary>
 /// 问答
 /// </summary>
 public static int AskQuestion(this ActivityOwnerTypes ActivityOwnerTypes)
 {
     return(1301);
 }
Example #27
0
        /// <summary>
        /// 动态处理程序
        /// </summary>
        /// <param name="barThread"></param>
        /// <param name="eventArgs"></param>
        private void BarThreadActivityModule_After(BarThread barThread, AuditEventArgs eventArgs)
        {
            //1、通过审核的内容才生成动态;(不满足)
            //2、把通过审核的内容设置为未通过审核或者删除内容,需要移除动态;(不满足)
            //3、把未通过审核的内容通过审核,需要添加动态; (不满足)
            //4、详见动态需求说明

            //生成动态
            ActivityService activityService = new ActivityService();
            AuditService    auditService    = new AuditService();
            bool?           auditDirection  = auditService.ResolveAuditDirection(eventArgs.OldAuditStatus, eventArgs.NewAuditStatus);

            if (auditDirection == true) //生成动态
            {
                if (barThread.BarSection == null)
                {
                    return;
                }

                var barUrlGetter = BarUrlGetterFactory.Get(barThread.TenantTypeId);
                if (barUrlGetter == null)
                {
                    return;
                }

                //生成Owner为帖吧的动态
                Activity actvityOfBar = Activity.New();
                actvityOfBar.ActivityItemKey = ActivityItemKeys.Instance().CreateBarThread();
                actvityOfBar.ApplicationId   = BarConfig.Instance().ApplicationId;

                AttachmentService        attachmentService = new AttachmentService(TenantTypeIds.Instance().BarThread());
                IEnumerable <Attachment> attachments       = attachmentService.GetsByAssociateId(barThread.ThreadId);
                if (attachments != null && attachments.Any(n => n.MediaType == MediaType.Image))
                {
                    actvityOfBar.HasImage = true;
                }

                actvityOfBar.IsOriginalThread      = true;
                actvityOfBar.IsPrivate             = false;
                actvityOfBar.UserId                = barThread.UserId;
                actvityOfBar.ReferenceId           = 0;//没有涉及到的实体
                actvityOfBar.ReferenceTenantTypeId = string.Empty;
                actvityOfBar.SourceId              = barThread.ThreadId;
                actvityOfBar.TenantTypeId          = TenantTypeIds.Instance().BarThread();
                actvityOfBar.OwnerId               = barThread.SectionId;
                actvityOfBar.OwnerName             = barThread.BarSection.Name;
                actvityOfBar.OwnerType             = barUrlGetter.ActivityOwnerType;
                activityService.Generate(actvityOfBar, false);

                if (!barUrlGetter.IsPrivate(barThread.SectionId))
                {
                    //生成Owner为用户的动态
                    Activity actvityOfUser = Activity.New();
                    actvityOfUser.ActivityItemKey  = actvityOfBar.ActivityItemKey;
                    actvityOfUser.ApplicationId    = actvityOfBar.ApplicationId;
                    actvityOfUser.HasImage         = actvityOfBar.HasImage;
                    actvityOfUser.HasMusic         = actvityOfBar.HasMusic;
                    actvityOfUser.HasVideo         = actvityOfBar.HasVideo;
                    actvityOfUser.IsOriginalThread = actvityOfBar.IsOriginalThread;
                    actvityOfUser.IsPrivate        = actvityOfBar.IsPrivate;
                    actvityOfUser.UserId           = actvityOfBar.UserId;
                    actvityOfUser.ReferenceId      = actvityOfBar.ReferenceId;
                    actvityOfUser.SourceId         = actvityOfBar.SourceId;

                    actvityOfUser.TenantTypeId = actvityOfBar.TenantTypeId;
                    actvityOfUser.OwnerId      = barThread.UserId;
                    actvityOfUser.OwnerName    = barThread.User.DisplayName;
                    actvityOfUser.OwnerType    = ActivityOwnerTypes.Instance().User();
                    activityService.Generate(actvityOfUser, false);
                }
            }
            else if (auditDirection == false) //删除动态
            {
                activityService.DeleteSource(TenantTypeIds.Instance().BarThread(), barThread.ThreadId);
            }
        }
Example #28
0
        /// <summary>
        /// 应用初始化
        /// </summary>
        /// <param name="containerBuilder">容器构建器</param>
        public override void Initialize(ContainerBuilder containerBuilder)
        {
            //注册标识图设置
            TenantLogoSettings.RegisterSettings(tenantLogoSettingsElement);

            //注册ResourceAccessor的应用资源
            ResourceAccessor.RegisterApplicationResourceManager(ApplicationId, "Spacebuilder.Group.Resources.Resource", typeof(Spacebuilder.Group.Resources.Resource).Assembly);
            InvitationType.Register(new InvitationType {
                Key = InvitationTypeKeys.Instance().InviteJoinGroup(), Name = "邀请参加群组", Description = ""
            });
            InvitationType.Register(new InvitationType {
                Key = InvitationTypeKeys.Instance().ApplyJoinGroup(), Name = "申请加入群组", Description = ""
            });
            containerBuilder.Register(c => new GroupActivityReceiverGetter()).Named <IActivityReceiverGetter>(ActivityOwnerTypes.Instance().Group().ToString()).SingleInstance();
            //groupId与groupKey的查询器
            containerBuilder.Register(c => new DefaultGroupIdToGroupKeyDictionary()).As <GroupIdToGroupKeyDictionary>().SingleInstance();

            //注册全文检索搜索器
            containerBuilder.Register(c => new GroupSearcher("群组", "~/App_Data/IndexFiles/Group", true, 7)).As <ISearcher>().Named <ISearcher>(GroupSearcher.CODE).SingleInstance();

            ThemeService.RegisterThemeResolver(PresentAreaKeysOfBuiltIn.GroupSpace, new GroupSpaceThemeResolver());

            //群组推荐
            containerBuilder.Register(c => new GroupApplicationStatisticDataGetter()).Named <IApplicationStatisticDataGetter>(this.ApplicationKey).SingleInstance();
            containerBuilder.Register(c => new GroupTenantAuthorizationHandler()).As <ITenantAuthorizationHandler>().SingleInstance();
        }
Example #29
0
        /// <summary>
        /// 获取以后进入用户时间线的动态
        /// </summary>
        public ActionResult _GetNewerActivities(string spaceKey, int?pageIndex, int?applicationId, MediaType?mediaType, bool?isOriginal, long?userId, long?lastActivityId = 0)
        {
            long groupId = GroupIdToGroupKeyDictionary.GetGroupId(spaceKey);
            //IEnumerable<Activity> newActivities= activityService.GetMyTimeline(userId.Value,null,applicationId,mediaType,isOriginal,pageIndex??1).Where(n => n.OwnerType == ActivityOwnerTypes.Instance().Group());
            IEnumerable <Activity> newActivities = activityService.GetOwnerActivities(ActivityOwnerTypes.Instance().Group(), groupId, applicationId, mediaType, isOriginal, null, pageIndex ?? 1, userId).Where(n => n.ActivityId > lastActivityId).ToList();

            if (newActivities != null && newActivities.Count() > 0)
            {
                ViewData["lastActivityId"] = newActivities.FirstOrDefault().ActivityId;
            }
            return(View(newActivities));
        }
Example #30
0
 /// <summary>
 /// 文章
 /// </summary>
 public static int Blog(this ActivityOwnerTypes ActivityOwnerTypes)
 {
     return(1002);
 }