Feat: 优化自动存点通知样式,系统消息不显示头像,改为绿色左边框简洁条形

This commit is contained in:
2026-02-27 12:51:29 +08:00
parent eb7bc58417
commit 638bc9deda
2 changed files with 15 additions and 9 deletions

View File

@@ -189,21 +189,21 @@ class AutoSaveExp extends Command
if ($actualJjbGain > 0) {
$gainParts[] = "金币+{$actualJjbGain}";
}
$gainStr = ! empty($gainParts) ? '(' . implode('', $gainParts) . ')' : '';
$jjbDisplay = $user->jjb ?? 0;
$gainStr = ! empty($gainParts) ? ' 本次获得:' . implode('', $gainParts) : '';
$levelInfo = $user->user_level >= $superLevel
? "级别({$user->user_level});经验({$user->exp_num});金币({$jjbDisplay}枚);已满级。"
: "级别({$user->user_level});经验({$user->exp_num});金币({$jjbDisplay}枚)。";
// 格式:⏰ 自动存点 · LV.100 · 经验 10,468 · 金币 8,345 · 已满级 · 本次获得:经验+1金币+3
$statusTag = $user->user_level >= $superLevel ? ' · 已满级 ✓' : '';
$content = "⏰ 自动存点 · LV.{$user->user_level} · 经验 {$user->exp_num} · 金币 {$jjbDisplay}{$statusTag}{$gainStr}";
$noticeMsg = [
'id' => $this->chatState->nextMessageId($roomId),
'room_id' => $roomId,
'from_user' => '系统',
'to_user' => $username, // 定向推送给本人
'content' => "【系统为你自动存点】{$levelInfo} {$gainStr}",
'is_secret' => true, // 私信模式,只有本人能看到
'font_color' => '#16a34a', // 草绿色
'to_user' => $username, // 定向推送给本人
'content' => $content,
'is_secret' => false, // 由 to_user + from_user='系统' 控制显示位置
'font_color' => '#16a34a', // 草绿色
'action' => '',
'sent_at' => now()->toDateTimeString(),
];

View File

@@ -218,7 +218,7 @@
let timeStrOverride = false;
// 系统用户名列表(不可被选为聊天对象)
const systemUsers = ['钓鱼播报', '星海小博士', '系统传音', '系统公告', 'AI小班长', '送花播报'];
const systemUsers = ['钓鱼播报', '星海小博士', '系统传音', '系统公告', 'AI小班长', '送花播报', '系统'];
// 用户名(单击切换发言对象,双击查看资料;系统用户仅显示文本)
const clickableUser = (uName, color) => {
if (systemUsers.includes(uName)) {
@@ -249,6 +249,12 @@
`<div style="font-size: 14px; font-weight: bold; color: #dc2626;">${msg.content} <span style="font-size: 10px; color: #999; font-weight: normal;">(${timeStr})</span></div>`;
// 由于我们把时间放进了特殊的结构里,这里把原有的外层时间置空,防止重复显示
timeStrOverride = true;
} else if (msg.from_user === '系统' && msg.to_user && msg.to_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 {
// 其他系统用户钓鱼播报、送花播报、AI小班长等普通样式
let giftHtml = '';