聊天消息头像也显示已购头像框特效

- DecorationService: getDecorationsForMessage() 加入 avatar_frame 字段
- 新增 .avatar-frame-wrapper-sm 紧凑版头像框样式(适配16px小头像)
- 消息渲染时检查 msg.avatar_frame 和 senderInfo.avatar_frame,包裹头像框
This commit is contained in:
pllx
2026-04-27 06:59:00 +00:00
parent 3db8e4ab82
commit d82aa1c434
2 changed files with 79 additions and 5 deletions
+6 -3
View File
@@ -175,11 +175,11 @@ class DecorationService
/**
* 获取消息广播 payload 需要携带的装扮字段。
*
* 消息广播需要气泡样式(msg_bubble)、昵称颜色(msg_name_color文字颜色特效(msg_text_color
* 头像框不需要在消息中展示
* 消息广播需要气泡样式(msg_bubble)、昵称颜色(msg_name_color文字颜色特效(msg_text_color
* 以及头像框avatar_frame),前端据此渲染发送者头像的装饰边框
*
* @param User $user 消息发送者
* @return array{msg_bubble?:string, msg_name_color?:string, msg_text_color?:string}
* @return array{msg_bubble?:string, msg_name_color?:string, msg_text_color?:string, avatar_frame?:string}
*/
public function getDecorationsForMessage(User $user): array
{
@@ -195,6 +195,9 @@ class DecorationService
if (! empty($decorations['text_color']['style'])) {
$result['msg_text_color'] = $decorations['text_color']['style'];
}
if (! empty($decorations['avatar_frame']['style'])) {
$result['avatar_frame'] = $decorations['avatar_frame']['style'];
}
return $result;
}