徽章分配系统框架设计的最佳方法
我目前正在设计一个教育网站。
为此,我们需要根据用户的活动为其分配一些徽章(例如 stackoverflow)。
我正在为此寻找一个框架。任何人都知道如何做到这一点?表格设计等。
我能想到的问题是:
- 我们可能有大量徽章,因此对于用户的每个操作,我们无法检查所有徽章并检查是否可以分配任何徽章
- 在添加新徽章和标准时这个,我不想更改现有代码来处理这个问题(我们可以有一些通用的解决方案吗?)
- 我应该选择哪个数据库(假设我的框架类似,当一个徽章的标准满足时,它会引发事件,并且这些规则是在数据库中创建(例如或者我可以使用 nosql db (就像 mongodb 一样,因为我的项目的其余部分都在 mongodb 中)
我最初的搜索给了我以下
- 规则引擎 -> 将导致非常繁琐的任务 “徽章”系统和数据库架构任意标准 (MySQL/PHP)
- 一个项目 http://drupal.org/project/ user_badges (无法正确理解)
- 人们说你的表结构应该是这样和这个..以及所有.. 存储徽章标准的最佳方式? 为我的网站创建“徽章”网站,存储用户徽章的最佳方式?使用 PHP
I am currently designing one education site.
For this we need to assign some badges to user based on their activity (like stackoverflow).
I was looking for a framework for this. Any one have any idea, how this can be done? Table design etc.
Issues which I could think of with this are :
- We may have large number of badges, so on each action of user we can not check all badges and check if any badge can be assigned
- On adding a new badge and criteria for this, I dont want to change the existing code to handle this (can we have some generic solution?)
- Which db should I choose (lets say if my framework in like, it raises the event when criteria for one badge satisfies and these rules are created in DB(like sql). or can I go for nosql db (like mongodb as my rest of the project is in mongodb )
My initial search gave me following things
- rule engine -> will result in very tedious task Database Architecture for "Badge" System & Arbitrary Criteria (MySQL/PHP)
- One project -> http://drupal.org/project/user_badges ( not able to understand it properly)
- people are saying your table structure should be like this and this ..and all ..
Best way to store Badge criteria?
Creating "Badges" for my site, best way to store user badges? Using PHP
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于这种方法,我肯定会选择关系数据库而不是 nosql 数据库。
您首先需要的是徽章的底层结构。
然后,您需要存储用户获得的所有徽章。因此,在您的用户部分:
现在您说您无法查询每个执行操作的所有徽章,因此您还应该为每个操作存储一个条目。例如,在您的“帖子”表中说:
然后您可以标准化并仅将与任何特定任务相关的徽章提供给您的规则引擎。
你最好的选择就是开始使用它们,如果你不明白那里有什么,那么你必须妥协并寻求基本逻辑,因此只为可以通过数据库条目(主要是数字数据)衡量的任务授予徽章。或者花更多的时间学习(并且费尽心思)。
I would definitely choose a relational database over a nosql database for this approach.
The first thing you need is the underlying structure of a badge.
You would then need to store all the badges a user has earned. So in your users section:
Now you say you can't query against all badges for each performed action, so you should also store an entry for each action. So say in your "posts" table for example:
You can then normalize and give only the badges related to any specific task to your rule engine.
Your best bet is just to start playing with them, if you don't understand what is out there than you must compromise and go for basic logic so only award badges for tasks that can be measured by database entries (mostly numerical data). Or spend more time learning (and pulling your hair out).