Exemple #1
0
        /// <summary>
        /// 设置指定帖子的最佳回复
        /// </summary>
        /// <param name="topic"></param>
        /// <param name="reply"></param>
        public static void SetTopicBestReply(TopicInfo topic, PostInfo reply)
        {
            topic.BestAnswerId = reply.PostId;

            BbsConfig config = BbsConfigs.GetBbsConfigCache();

            reply.IsBestReply        = true;
            reply.SetBestDate        = DateTime.Now;
            reply.ExpChanged         = config.PostBeBestAnswerExpChanged;
            reply.VirtualCoinChanged = topic.Reward > 0 ? topic.Reward : config.PostBeBestAnswerCoinChanged;

            //更新帖子和回复
            BbsData.SetTopicBestReply(topic, reply);

            if (reply.ExpChanged != 0)
            {
                UserBiz.UpdateUserExp(reply.UserId, reply.ExpChanged, "跟帖被设定为最佳回复");
            }

            if (reply.VirtualCoinChanged != 0)
            {
                UserBiz.UpdateUserCoin(reply.UserId, reply.VirtualCoinChanged, "跟帖被设定为最佳回复");
            }

            UserBiz.SetUserCacheInfo(reply.UserId);
        }
Exemple #2
0
        /// <summary>
        /// 创建帖子
        /// </summary>
        /// <param name="topic"></param>
        public static void CreateTopic(TopicFullInfo topic)
        {
            BbsConfig config = BbsConfigs.GetBbsConfigCache();

            topic.Status = config.TopicIsAudited ? 1 : 0;
            BbsData.CreateTopic(topic);

            //发布成功,并且为即时显示的(如果默认未审核,则以下操作需要在管理后台进行第一次通过审核操作时执行)
            if (topic.TopicId > 0 && topic.Status == 1)
            {
                if (config.CreateTopicExpChanged != 0)
                {
                    UserBiz.UpdateUserExp(topic.UserId, config.CreateTopicExpChanged, "发布帖子");
                }

                if (config.CreateTopicCoinChanged != 0)
                {
                    UserBiz.UpdateUserCoin(topic.UserId, config.CreateTopicCoinChanged, "发布帖子");
                }

                //发布悬赏帖,先扣除发布人悬赏的虚拟币额度
                if (topic.Reward > 0)
                {
                    UserBiz.UpdateUserCoin(topic.UserId, -topic.Reward, "发布悬赏帖扣除");
                }

                UserBiz.SetUserCacheInfo(topic.UserId);
            }
        }
Exemple #3
0
        /// <summary>
        /// 创建跟帖信息
        /// </summary>
        /// <param name="postInfo"></param>
        public static void CreateReply(PostFullInfo postInfo)
        {
            BbsConfig config = BbsConfigs.GetBbsConfigCache();

            postInfo.Status = config.PostIsAudited ? 1 : 0;
            BbsData.CreateReply(postInfo);

            //发布成功,并且为即时显示的(如果默认未审核,则以下操作需要在管理后台进行第一次通过审核操作时执行)
            if (postInfo.PostId > 0 && postInfo.Status == 1)
            {
                if (config.CreatePostExpChanged != 0)
                {
                    UserBiz.UpdateUserExp(postInfo.UserId, config.CreatePostExpChanged, "发布跟帖");
                }

                if (config.CreatePostCoinChanged != 0)
                {
                    UserBiz.UpdateUserCoin(postInfo.UserId, config.CreatePostCoinChanged, "发布跟帖");
                }

                UserBiz.SetUserCacheInfo(postInfo.UserId);

                //如果被回复的目标用户关注了跟帖发布人,并且接收提醒消息,此处应该PUSH消息给被回复的目标用户
                if (postInfo.UserId != postInfo.ReplyForUserId && postInfo.ReplyForUserId > 0)
                {
                    UserCacheInfo userCache = UserBiz.ReadUserCacheInfo(postInfo.ReplyForUserId);
                    if (userCache.RemindTopicBeReply && SocialBiz.AlreadyBeFollowed(postInfo.ReplyForUserId, postInfo.UserId))
                    {
                        //Todo  postInfo.ReplyForUserId
                    }
                }
            }
        }