实施通知系统
在我的项目中,用户可以发布他们的消息,其他人可以添加评论)到他们的帖子。我只是想让他们收到有关此类事件的通知,这样他们就不需要检查他们的每一篇帖子和之前的评论来看看是否有新内容。
很抱歉这个通用问题,但我只想知道“如何为此目的实施适当的方法?”
In my project, users can post their messages and others can add comment(s) to their posts. I just want them to be notified on such events, so that there is no need for them to check each one of their posts and previous comments to see if there is something new.
Sorry for this generic question but I just want to know "how to implement an appropriate approach for this purpose?"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
创建另一个名为“Notifcations”的表,其中包含用户 ID 和要向用户显示的文本。您可能还想添加通知的链接。
当用户对帖子发表评论时,只需弄清楚应该通知哪些用户并将他们的消息放入“通知”表中即可。
注意:不要忘记清理您的通知表,因为它可能会增长得非常快,而且您实际上并不希望在很长一段时间内存档它(从我的角度来看)。
Create another table called Notifcations, with a user ID and the text to show to the user. You might also want to add a link to the notification.
When a user comments on a post, just figure out what users should be notified and put their messages in the Notifications table.
Note: don't forget to clean up your Notifications table, as it might grow pretty quick and it's not really something you would like to archive over a very long period (from my point of view).