From 43956d286e077f2782f70fc66ef03a79058459a5 Mon Sep 17 00:00:00 2001 From: lkddi Date: Fri, 27 Feb 2026 16:30:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E7=A4=BC=E7=89=A9?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E6=B6=88=E6=81=AF=E5=AD=97=E6=AE=B5=E5=90=8D?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=20from=5Fuser/to=5Fuser/sent=5Fat=20?= =?UTF-8?q?=E4=B8=8E=E5=89=8D=E7=AB=AF=20appendMessage()=20=E5=8C=B9?= =?UTF-8?q?=E9=85=8D=EF=BC=8C=E8=A7=A6=E5=8F=91=E9=87=91=E8=89=B2=E8=BE=B9?= =?UTF-8?q?=E6=A1=86=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/ShopController.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/app/Http/Controllers/ShopController.php b/app/Http/Controllers/ShopController.php index d1b60c3..14a9620 100644 --- a/app/Http/Controllers/ShopController.php +++ b/app/Http/Controllers/ShopController.php @@ -110,24 +110,25 @@ class ShopController extends Controller 'lightning' => '⚡', 'snow' => '❄️', ]; + // 赠礼消息文案(简洁精美) $icon = $icons[$result['play_effect']] ?? '✨'; $toStr = $targetUsername ? "【{$targetUsername}】" : '全体聊友'; - $msgText = $message - ? "「{$message}」" - : ''; - $sysContent = "{$icon} 【{$user->username}】送出了一张 [{$item->name}],赠给 {$toStr}!{$msgText}"; + $remarkPart = $message ? " 「{$message}」" : ''; + $sysContent = "{$icon} {$user->username} 送了一张【{$item->name}】给 {$toStr}!{$remarkPart}"; - // 广播系统消息到公屏(ShouldBroadcastNow 模式) + // 广播系统消息到公屏(字段名与前端 appendMessage() 保持一致) $sysMsgEvent = new MessageSent( roomId: $roomId, message: [ 'id' => 0, 'room_id' => $roomId, - 'username' => '系统', + 'from_user' => '系统传音', // 触发金色左边框样式(已有处理分支) + 'to_user' => '大家', 'content' => $sysContent, - 'type' => 'sys', - 'color' => '#cc6600', - 'created_at' => now()->toDateTimeString(), + 'font_color' => '#cc6600', + 'sent_at' => now()->format('H:i:s'), + 'is_secret' => false, + 'action' => null, ] ); broadcast($sysMsgEvent);