如何处理用户通知弹出窗口“功能区”? - 类似于SO的?
在我的 asp.net MVC 应用程序中,我正在计划一个类似于 SO 的用户通知系统。这是我正在考虑的表结构:
Message table
--------------------------------
PK MsgId BigInt
FK UserId UniqueIdentifier
Body nvarchar(200)
IsRead TinyInt
DateSent DateTime
首先,这个数据库结构看起来没问题吗?有更好的办法吗?
顶部的功能区将显示用户有未读消息。当用户访问该消息的页面时,该消息会自动变为已读状态(无需单击“标记为已读”按钮。[将 IsRead 字段更改为 1] 将
功能区构建为在有消息时始终可见未读消息很容易如何构建它以让用户隐藏功能区,即使他们有未读消息 - 然后不在用户访问的下一个内部页面上加载功能区?
In my asp.net MVC app, I'm planning a user notification system similar to SO's. Here's the table structure I'm thinking of:
Message table
--------------------------------
PK MsgId BigInt
FK UserId UniqueIdentifier
Body nvarchar(200)
IsRead TinyInt
DateSent DateTime
First, does this DB structure look ok? is there a better way?
A ribbon at the top will show the user has unread messages. The message automatically becomes read when the user visits that message's page (no need to click a "mark as read" button. [changes the IsRead field to 1]
Building the ribbon to always be visible when there is an unread message is easy. How do you build it to let the user hide the ribbon, even if they have unread messages - and then NOT load the ribbon on the next internal page the user visits?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我会添加一个类似“IsAcknowledged”的标志,这样只有在
!IsRead && 时才可以显示功能区!IsAcknowledged
然后,当用户单击“x”或其他任何内容时,使用 AJAX 更新标志。这样,IsRead
标志就会被保留,因此当用户选择查看他的消息时,您仍然知道哪些消息尚未被阅读。另外,不确定您使用的是什么 DBMS,但对于 MSSQL 中的布尔字段,我喜欢使用
bit
类型。I would add a flag something like "IsAcknowledged", so you can show the ribbon only if
!IsRead && !IsAcknowledged
then use AJAX to update the flag when the user clicks the "x", or whatever. that way theIsRead
flag is maintained so when the user chooses to see his messages you still know which ones haven't been read.also, not sure what DBMS you're using, but for boolean fields in MSSQL I like to use the
bit
type.有很多 jquery 插件可以让你拥有这个漂亮的动画通知栏,例如 jGrowl和jBar。只需选择其中之一,尝试一下,如果您在实施时遇到问题,请随时询问。
There are many jquery plugins that allow you to have this nice animated notification bar such as jGrowl and jBar. Just pick one of them, try it and if you have problems implementing it don't hesitate to ask.