diff --git a/app/Console/Commands/AutoSaveExp.php b/app/Console/Commands/AutoSaveExp.php index 015b90f..e6cd955 100644 --- a/app/Console/Commands/AutoSaveExp.php +++ b/app/Console/Commands/AutoSaveExp.php @@ -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(), diff --git a/resources/views/chat/partials/scripts.blade.php b/resources/views/chat/partials/scripts.blade.php index be83fad..770d2be 100644 --- a/resources/views/chat/partials/scripts.blade.php +++ b/resources/views/chat/partials/scripts.blade.php @@ -266,11 +266,19 @@ `${headImg}${msg.from_user}:${msg.content}${giftHtml}`; } } else if (msg.is_secret) { - // 悄悄话样式(原版:紫色斜体) - html = - `${headImg}${clickableUser(msg.from_user, '#cc00cc')}对${clickableUser(msg.to_user, '#cc00cc')}`; - if (msg.action) html += `${msg.action}`; - html += `悄悄说:${msg.content}`; + 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 = + `📢 系统:${msg.content}`; + } else { + // 普通悄悄话样式(原版:紫色斜体) + html = + `${headImg}${clickableUser(msg.from_user, '#cc00cc')}对${clickableUser(msg.to_user, '#cc00cc')}`; + if (msg.action) html += `${msg.action}`; + html += `悄悄说:${msg.content}`; + } } 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}`;