一千萬個為什麽

搜索

如何設計邏輯來存儲為網站用戶分配徽章和信譽點的規則

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).

我想要找出解決方案:

  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.

任何提示都會欣賞嗎?

最佳答案

數據庫似乎不是滿足此要求的合適工具。好像你需要在應用層實現這樣的邏輯。當然,某些參數值可以來自配置文件。

如果這是您真正想要做的一種方法,那就是在列中定義變量(例如視圖,投票)。您的徽章分配的輸出或信譽點也可以是列,但其他列的功能。 所以表格看起來像:
badgeId_的 _ </強> badgeName _ </強> 視圖__ </強> 投票結果 1 _ ____ </強> _ ____ </強> 10 <�強> _ ___ </強> 2,點擊 2 _ ____ </強> _ __ _ < /強> 100 _ __ </強> _10

轉載註明原文: 如何設計邏輯來存儲為網站用戶分配徽章和信譽點的規則