用户报告库
我想构建(或找到)一个 php 报告库,我可以使用它来允许我的用户报告任何类型的不良内容。实际上,如果他们能够将内容报告为良好(我想这意味着评级系统)那就更好了。因此,如果有人知道这样的图书馆,我很想听听。
无论如何,这就是我想象的数据库工作方式,我想知道这听起来是否正确。
- ID - 行 ID
- USER_ID - 投票/报告用户的 ID
- ITEM_ID - 报告项目的唯一表行 ID(帖子、其他用户、链接等...)
- TYPE - 所属表的名称(帖子、用户、链接等...)
- 日期 - 报告的日期时间
- 值 - 我想这可能是赞成票或反对票
通过包含 [类型] 列,我可以在网站上的所有内容类型中使用此投票系统,而不仅仅是一个(如论坛帖子)。通过存储 user_id,我可以确保每个用户的每个项目仅投一票/报告。
I would like to build (or find) a php reporting library that I can use to allow my users to report any type of content as bad. Actually, if they could report content as good (which I guess would mean a rating system) that would be even better. So if anyone knows of a library like this I would love to hear about it.
Anyway, this is how I imagine the database working and I would like to know if this sounds correct.
- ID - ID of row
- USER_ID - ID of the user voting/reporting
- ITEM_ID - UNIQUE table row ID of the item reported (post, other user, link, etc...)
- TYPE - the name of the table this pertains to (posts, users, links, etc...)
- DATE - datetime of report
- VALUE - I guess this could be an UP vote or DOWN vote
By including the [TYPE] column I can use this voting system across all content types on my site instead of just one (like forum posts). By storing the user_id I can be sure that only one vote/report is cast per item per user.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我按照我说的继续建造它。弗兰克是对的,这并不难。下面是代码,以防其他人想要在支持 AR 风格的数据库调用(如 CodeIgniter 或 MicroMVC)的 MVC 上使用它:
Well, I went ahead and built it like I said. Frank was right, it wasn't too hard. Here is the code incase anyone else wants to use it on a MVC that supports AR styled DB calls like CodeIgniter or MicroMVC: