From fc7930046dda9b0d83eed03eac49a1ea88de0765 Mon Sep 17 00:00:00 2001 From: pllx Date: Thu, 30 Apr 2026 11:08:39 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E4=B8=80=E5=BA=A7=E9=A9=BE=E6=92=AD?= =?UTF-8?q?=E6=8A=A5=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/RideService.php | 5 +++-- tests/Feature/ChatControllerTest.php | 11 ++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/Services/RideService.php b/app/Services/RideService.php index 661e11d..44f4604 100644 --- a/app/Services/RideService.php +++ b/app/Services/RideService.php @@ -236,14 +236,15 @@ class RideService '{ride}' => $item->name, ]); $identitySummary = $this->chatUserPresenceService->buildIdentitySummary($user); + $effectUserInfo = "用户 {$user->username} · {$identitySummary['inline']}"; return [ 'ride_key' => $rideKey, 'ride_name' => $item->name, 'ride_icon' => (string) ($item->icon ?? '🚘'), 'effect_title' => "{$user->username} 乘坐【{$item->name}】闪亮登场", - 'effect_user_info' => $identitySummary['inline'], - 'identity_text' => ChatContentSanitizer::htmlText($identitySummary['inline']), + 'effect_user_info' => $effectUserInfo, + 'identity_text' => ChatContentSanitizer::htmlText($effectUserInfo), 'welcome_text' => ChatContentSanitizer::htmlText($rendered), ]; } diff --git a/tests/Feature/ChatControllerTest.php b/tests/Feature/ChatControllerTest.php index ecea5fb..0420a2b 100644 --- a/tests/Feature/ChatControllerTest.php +++ b/tests/Feature/ChatControllerTest.php @@ -1133,12 +1133,13 @@ class ChatControllerTest extends TestCase $this->assertSame('座驾播报', $rideMessage['from_user']); $this->assertSame('j35', $rideMessage['ride_key']); $this->assertSame("{$user->username} 乘坐【歼-35测试座驾】闪亮登场", $rideMessage['effect_title']); - $this->assertSame('部门 无部门 · 职务 无职务 · 会员 普通会员', $rideMessage['effect_user_info']); + $this->assertSame("用户 {$user->username} · 部门 无部门 · 职务 无职务 · 会员 普通会员", $rideMessage['effect_user_info']); $this->assertStringContainsString($user->username, $rideMessage['content']); + $this->assertStringContainsString("用户 {$user->username} · 部门 无部门 · 职务 无职务 · 会员 普通会员", $rideMessage['content']); $this->assertSame('j35', $response->viewData('initialRideEffect')); $this->assertSame([ 'effect_title' => "{$user->username} 乘坐【歼-35测试座驾】闪亮登场", - 'effect_user_info' => '部门 无部门 · 职务 无职务 · 会员 普通会员', + 'effect_user_info' => "用户 {$user->username} · 部门 无部门 · 职务 无职务 · 会员 普通会员", 'ride_name' => '歼-35测试座驾', 'operator' => $user->username, ], $response->viewData('initialRideEffectOptions')); @@ -1211,11 +1212,11 @@ class ChatControllerTest extends TestCase $this->assertNotNull($rideMessage); $this->assertNull($vipPresenceMessage); - $this->assertStringContainsString('部门 战备部 · 职务 🛡️ 试飞官 · 会员 👑 至尊会员', $rideMessage['content']); - $this->assertSame('部门 战备部 · 职务 🛡️ 试飞官 · 会员 👑 至尊会员', $rideMessage['effect_user_info']); + $this->assertStringContainsString("用户 {$user->username} · 部门 战备部 · 职务 🛡️ 试飞官 · 会员 👑 至尊会员", $rideMessage['content']); + $this->assertSame("用户 {$user->username} · 部门 战备部 · 职务 🛡️ 试飞官 · 会员 👑 至尊会员", $rideMessage['effect_user_info']); $this->assertStringContainsString($user->username, $rideMessage['content']); $this->assertSame('99a', $response->viewData('initialRideEffect')); - $this->assertSame('部门 战备部 · 职务 🛡️ 试飞官 · 会员 👑 至尊会员', $response->viewData('initialRideEffectOptions')['effect_user_info']); + $this->assertSame("用户 {$user->username} · 部门 战备部 · 职务 🛡️ 试飞官 · 会员 👑 至尊会员", $response->viewData('initialRideEffectOptions')['effect_user_info']); $this->assertNull($response->viewData('initialPresenceTheme')); }