优化:送花消息改为普通通知样式 + 在收花人私聊屏显示
- from_user 从'系统传音'改为'送花播报',不再使用红色公告样式 - to_user 从'大家'改为收花人用户名,消息在收花人 say2 显示 - 礼物图片渲染逻辑移到普通系统用户分支
This commit is contained in:
@@ -503,8 +503,8 @@ class ChatController extends Controller
|
||||
$sysMsg = [
|
||||
'id' => $this->chatState->nextMessageId($roomId),
|
||||
'room_id' => $roomId,
|
||||
'from_user' => '系统传音',
|
||||
'to_user' => '大家',
|
||||
'from_user' => '送花播报',
|
||||
'to_user' => $toUsername,
|
||||
'content' => "{$gift->emoji} {$user->username} 向 {$toUsername} 送出了{$countText}【{$gift->name}】!魅力 +{$totalCharm}!",
|
||||
'is_secret' => false,
|
||||
'font_color' => '#e91e8f',
|
||||
|
||||
@@ -217,7 +217,7 @@
|
||||
const timeStr = msg.sent_at || '';
|
||||
|
||||
// 系统用户名列表(不可被选为聊天对象)
|
||||
const systemUsers = ['钓鱼播报', '星海小博士', '系统传音', '系统公告', 'AI小助手'];
|
||||
const systemUsers = ['钓鱼播报', '星海小博士', '系统传音', '系统公告', 'AI小助手', '送花播报'];
|
||||
// 用户名(单击切换发言对象,双击查看资料;系统用户仅显示文本)
|
||||
const clickableUser = (uName, color) => {
|
||||
if (systemUsers.includes(uName)) {
|
||||
@@ -240,18 +240,17 @@
|
||||
// 管理员公告/系统传音:大字醒目样式
|
||||
div.style.cssText =
|
||||
'background: linear-gradient(135deg, #fef2f2, #fff1f2); border: 2px solid #ef4444; border-radius: 6px; padding: 8px 12px; margin: 4px 0; box-shadow: 0 2px 4px rgba(239,68,68,0.15);';
|
||||
// 如果是送花消息,显示礼物图片
|
||||
html =
|
||||
`<div style="font-size: 14px; font-weight: bold; color: #dc2626;">${msg.content}</div>`;
|
||||
} else {
|
||||
// 其他系统用户(钓鱼播报、送花播报、AI小助手等):普通样式
|
||||
let giftHtml = '';
|
||||
if (msg.gift_image) {
|
||||
giftHtml =
|
||||
`<img src="${msg.gift_image}" alt="${msg.gift_name || ''}" style="display:inline-block;width:40px;height:40px;vertical-align:middle;margin-left:6px;animation:giftBounce 0.6s ease-in-out;">`;
|
||||
}
|
||||
html =
|
||||
`<div style="font-size: 14px; font-weight: bold; color: #dc2626;">${msg.content}${giftHtml}</div>`;
|
||||
} else {
|
||||
// 其他系统用户(钓鱼播报、AI小助手等):普通样式
|
||||
html =
|
||||
`${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>`;
|
||||
`${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) {
|
||||
// 悄悄话样式(原版:紫色斜体)
|
||||
|
||||
Reference in New Issue
Block a user