想要类似 Youtube 的喜欢/不喜欢评级系统代码吗? [英] Youtube-like like/dislike rating system code wanted?
问题描述
我正在尝试制作一个评级系统,非常类似于 Youtube 的拇指向上/向下.实际上,我希望达到完全相同的目标.但从我从这里收集的信息:http://code.google.com/apis/youtube/2.0/developers_guide_protocol.html#Ratings
I am trying to make a rating system, very similar to Youtube's thumbs Up/Down. Actually, I was hoping to achieve exactly the same. But from what I gather from here: http://code.google.com/apis/youtube/2.0/developers_guide_protocol.html#Ratings
Youtube 使用 API 来处理所有评级.因此,我正在寻找有关如何设置 YT 相同系统的信息和帮助.我基本上希望每个页面都有一个喜欢/不喜欢的功能,喜欢该页面上的特定对象 - 就像喜欢/不喜欢链接到每个页面上的视频一样.最好也是一个评论.非常欢迎所有帮助.从已经完成的系统的源代码(我在谷歌上搜索了很多,但从未找到类似的开源评级系统)到我如何设置 API 驱动的评级系统的帮助和信息.
Youtube uses an API to take care of all the Ratings. So I am looking for info and help on how can I set up the same system YT has. I basically want to have a Like/Dislike function for every page, which is liked to a specific object on that page - just like the like/dislike is linked to a video on every page. Preferrably also one for comments. All help is very very welcomed. From source-codes for already done systems (I searched around google quite a bit, but never found a similar open-source rating system) to help and info on how I can set up the API-powered rating system.
推荐答案
对于数据库部分,如果你需要知道哪些用户喜欢哪些视频,那么使用两张桌子,一张是喜欢的,一张是不喜欢的:
For the database part, if you need to know which users liked which videos, then use two tables, one for likes and one for dislikes:
TABLE likes {
user_id
video_id
}
TABLE dislikes {
user_id
video_id
}
两个表都将用户与视频相关联.
Both tables associate a user with a video.
这篇关于想要类似 Youtube 的喜欢/不喜欢评级系统代码吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!