SPB-可配置服务-积分

来自站长百科
跳转至: 导航、​ 搜索

导航: 上一页

积分是指Application的哪些操作会影响到用户的积分,在积分项目及积分规则中进行相应设置。

积分类别分为:基础积分、声誉积分、信誉积分、交易积分。只有交易积分可以减少,其他类别的积分只能不断增加(处罚时除外)。

  1. 基础积分用于体现用户在站点的参与程度;
  2. 声誉积分用于体现用户在站点的知名度;
  3. 信誉积分用于体现用户在站点的真实及诚信指数;
  4. 交易积分是用于在站点内流通的虚拟货币。

一、积分项目(PointItems)

示例:

Spacebuilder0107.jpg


注意:ItemKey必须唯一

二、积分项目积分规则(UserPointItemRules)

示例:

Spacebuilder0108.jpg

三、综合积分规则

为了保证客观性经常需要从多个角度对积分主体进行评价,因此需要设置综合积分规则。

例如:用户等级是根据用户的综合积分来进行计算的,用户的综合积分默认设置为:

  • 用户综合积分=基础积分/2 + 声誉积分 + 信誉积分
  • 活动积分=活动参与人数*1+活动照片*0.5+活动留言*0.2+活动浏览量*0.01
  • 圈子积分=成员数量*1+圈子内容数量*0.1+浏览量*0.01+SUM(活动积分)*0.1
  • 博客积分=文章数*4+评论数*1+浏览量*0.1
  • 相册积分=图片数*4+评论数*1+浏览量*0.1

四、积分记录 记录积分收入、支出记录

五、如何使用积分?

  1. 关于积分项目的分析以及配置,参见“如何使用权限”;
  2. 如何增减积分并自动积分记录

采用ExtensionModule进行积分处理,例如:SpaceBuilder.Forum.Modules.DisposePointForForum

/// <summary>
    /// 处理与论坛相关的积分
    /// </summary>
    public class DisposePointForForum : IForumModule
    {
        #region IForumModule 成员

        public void Init(ForumEventManager eventManager, System.Xml.XmlNode node)
        {
eventManager.AfterForumThreadChange += new ForumThreadEventHandler(eventManager_AfterForumThreadChange);
eventManager.AfterForumPostChange += new ForumPostEventHandler(eventManager_AfterForumPostChange);
eventManager.SetForumThreadSpecial += new ForumThreadSpecialEventHandler(eventManager_SetForumThreadSpecial);
        }

        void eventManager_AfterForumThreadChange(ForumThread forumThread, GlobalEventArgs e)
        {
            if (e.State == ObjectState.Create || e.State == ObjectState.Delete)
            {
                List<UserPointRecord> records = new List<UserPointRecord>();
                UserPointItemRole role = null;
                string userPointRecordDescription = string.Empty;
                if (e.State == ObjectState.Create)
                {
 role = SpaceBuilder.Common.Points.GetUserPointItemRole(UserPointItemKeys.Instance().CreateForumThread());
 userPointRecordDescription = "发布论坛主题:" + forumThread.Subject;
                }
                else if (e.State == ObjectState.Delete)
                {
 role = SpaceBuilder.Common.Points.GetUserPointItemRole(UserPointItemKeys.Instance().DeleteForumThread());
 userPointRecordDescription = "删除论坛主题:" + forumThread.Subject;
                }
 PopulateUserPointRecords(records, role, forumThread.UserID, userPointRecordDescription);
                if (role != null)
                {
  SpaceBuilder.Common.Points.CreateUserPointRecords(records);
                }
            }
        }
……
}

参考资料[ ]