Achievements / Badges system

后端 未结 4 769
情歌与酒
情歌与酒 2021-01-29 19:29

I have been browsing this site for the answer but I\'m still a little unsure how to plan a similar system in its database structure and implementation.

In PHP and MySQL

4条回答
  •  伪装坚强ぢ
    2021-01-29 20:28

    I think the structure you've suggested (without the "assigned" field as per the comments) would work, with the addition of an additional table, say "Submissions_User", containing a reference to user_id & an incrementing field for counting submissions. Then all you'd need is an "event listener" as per this post and methinks you'd be set.

    EDIT: For the achievement badges, run the event listener upon each submission (only for the user making the submission of course), and award any relevant badge on the spot. For the time-based badges, I would run a CRON job each night. Loop through the complete user list once and award badges as applicable.

提交回复
热议问题