TanzCMS开源CMS系统

消息通知

会员消息通知入口、未读数量和列表模板说明

更新:2026-05-30 22:16:23 浏览:3

消息通知

头部未读提醒

<a class="member-notification-link" href="{member_url path=notifications}" title="消息通知">
  <i class="fas fa-bell"></i>
  {if $member.notification_unread_count}<span>{$member.notification_unread_count}</span>{/if}
</a>
变量 说明
$member.notification_unread_count 当前会员未读消息数量
{member_url path=notifications} 消息通知列表

通知列表

{loop $notifications $notice}
  <article class="notice-item {if !$notice.read_at}is-unread{/if}">
    <h3>{$notice.title}</h3>
    <p>{$notice.content}</p>
    <time>{$notice.created_at}</time>
    {if $notice.url}<a href="{$notice.url}">查看详情</a>{/if}
  </article>
{empty}
  <p>暂无消息</p>
{/loop}

全部已读

<form action="{member_url path='notifications/read-all'}" method="post">
  <input type="hidden" name="_token" value="{$csrf}">
  <button type="submit">全部标记为已读</button>
</form>

单条已读

fetch('/member/notifications/' + id + '/read', {
  method: 'POST',
  headers: {'X-CSRF-TOKEN': '{$csrf}', 'Accept': 'application/json'}
})

常见通知来源

场景 说明
投稿审核 投稿通过、驳回、待处理
订单状态 支付成功、交付更新、订单关闭
活动中奖 限时活动中奖和履约进度
充值提现 充值结果、提现审核结果