Exemple #1
0
        /// <summary>
        /// 清除用户关注
        /// </summary>
        /// <param name="userId">用户Id</param>
        public void CleanByUser(long userId)
        {
            followRepository.CleanByUser(userId);

            FollowEntity follow = FollowEntity.New();

            follow.UserId = userId;
            EventBus <FollowEntity> .Instance().OnAfter(follow, new CommonEventArgs(EventOperationType.Instance().Delete()));
        }
Exemple #2
0
        /// <summary>
        /// 关注用户
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="followUserId">被关注用户Id</param>
        /// <param name="isQuietly">是否悄悄关注</param>
        public bool Follow(long userId, long followUserId, bool isQuietly = false)
        {
            FollowEntity follow = FollowEntity.New();

            follow.UserId         = userId;
            follow.FollowedUserId = followUserId;
            follow.IsQuietly      = isQuietly;

            EventBus <FollowEntity> .Instance().OnBefore(follow, new CommonEventArgs(EventOperationType.Instance().Create()));

            bool isSuccess = followRepository.Follow(userId, followUserId, isQuietly);

            EventBus <FollowEntity> .Instance().OnAfter(follow, new CommonEventArgs(EventOperationType.Instance().Create()));

            return(isSuccess);
        }