Fix: 系统存点通知改回悄悄话私信,避免多人刷屏;前端单独渲染为绿色通知条无头像

This commit is contained in:
2026-02-27 12:53:30 +08:00
parent 638bc9deda
commit caecceba1b
2 changed files with 14 additions and 6 deletions
+1 -1
View File
@@ -202,7 +202,7 @@ class AutoSaveExp extends Command
'from_user' => '系统',
'to_user' => $username, // 定向推送给本人
'content' => $content,
'is_secret' => false, // 由 to_user + from_user='系统' 控制显示位置
'is_secret' => true, // 私信模式:前端过滤,只有收件人才能看到
'font_color' => '#16a34a', // 草绿色
'action' => '',
'sent_at' => now()->toDateTimeString(),
@@ -266,11 +266,19 @@
`${headImg}<span class="msg-user" style="color: ${fontColor}; font-weight: bold;">${msg.from_user}</span><span class="msg-content" style="color: ${fontColor}">${msg.content}</span>${giftHtml}`;
}
} else if (msg.is_secret) {
// 悄悄话样式(原版:紫色斜体)
html =
`<span class="msg-secret">${headImg}${clickableUser(msg.from_user, '#cc00cc')}对${clickableUser(msg.to_user, '#cc00cc')}`;
if (msg.action) html += `${msg.action}`;
html += `悄悄说:${msg.content}</span>`;
if (msg.from_user === '系统') {
// 系统悄悄通知(自动存点等):绿色左边框条形,无头像,不显示"悄悄说"
div.style.cssText =
'background:#f0fdf4;border-left:3px solid #16a34a;border-radius:4px;padding:3px 8px;margin:2px 0;font-size:12px;';
html =
`<span style="color:#16a34a;font-weight:bold;">📢 系统:</span><span style="color:#15803d;">${msg.content}</span>`;
} else {
// 普通悄悄话样式(原版:紫色斜体)
html =
`<span class="msg-secret">${headImg}${clickableUser(msg.from_user, '#cc00cc')}对${clickableUser(msg.to_user, '#cc00cc')}`;
if (msg.action) html += `${msg.action}`;
html += `悄悄说:${msg.content}</span>`;
}
} else if (msg.to_user && msg.to_user !== '大家') {
html = `${headImg}${clickableUser(msg.from_user, '#000099')}对${clickableUser(msg.to_user, '#000099')}`;
if (msg.action) html += `${msg.action}`;