问题描述:

In my current web application, I have to create a "Reputation Points & Badges Engine" somewhat similar to SO. That system contains many rules and each rule is associated with a few predefined user activities (like view question, vote question, etc).

What I am trying to figure out the solution for:

  1. Store all rules in database tables (almost each rule includes multiple conditions). can we do this?
  2. To match each user action with rules saved in db tables and assign the associated reputation points and badges.

    • Check if user already got the reward to the threshold value (e.g not of votes, views), defined in rule.
    • Perform certain actions like promote user, notify user, ban user defined in few rules.
  3. Provide an UI to admin of the application to Manage(add new / edit / delete) rules in application.

Any hints would be appreciate?

网友答案:

Database doesn't seem to be the appropriate tool for this requirement. Seems like you will need to implement such logic in application layer. of course, certain parameter values can come from config files.

One way if this is what you really really want to do, is to have variables (such as views, votes) defined in columns. The output your badge assigned or reputation point can also be column but the function of other columns. so table would look like:
badgeId__badgeName_views__votes
1
_____silver_____10____2
2
_____gold____100____10

相关阅读:
Top