How to implement badges?

前端 未结 4 1260
无人共我
无人共我 2020-12-07 07:33

I\'ve given some thought to implementing badges (just like the badges here on Stack Overflow) and think it would be difficult without Windows services, but I\'d like to avoi

4条回答
  •  太阳男子
    2020-12-07 08:05

    comments must be stored within the database right? then i think there are two main ways to do this.

    1) when a user logs in you get a count of the comments. this is obvisously not the desired approach as the count could take a lot of time

    2) when a user posts a comment you could either do a count then and store the count with the use details or you could do a trigger which executes when a comment is added. the trigger would then get the details of the newly created comment, grab the user id, get a count and store that against the user in a table of some sort.

    i like the idea of a trigger as your program can return w/out waiting for sql server to do its stuff.

提交回复
热议问题