feat: 任命/撤销通知系统 + 用户名片UI优化

- 任命/撤销事件增加 type 字段区分类型
- 任命:全屏礼花 + 紫色弹窗 + 紫色系统消息
- 撤销:灰色弹窗 + 灰色系统消息,无礼花
- 消息分发:操作者/被操作者显示在私聊面板,其他人显示在公屏
- 系统消息加随机鼓励语(各5条轮换)
- ChatStateService 修复 Redis key 前缀扫描问题(getAllActiveRoomIds)
- 用户名片折叠优化:管理员视野、职务履历均可折叠
- 管理操作 + 职务操作合并为「🔧 管理操作」折叠区
- 悄悄话改为「🎁 送礼物」按钮,礼物面板内联展开
This commit is contained in:
2026-02-28 23:44:38 +08:00
parent a599047cf0
commit 5f30220609
80 changed files with 8579 additions and 473 deletions
@@ -0,0 +1,80 @@
{{--
文件功能:任职期间登录记录子页
展示某个用户在职期间的每次登录时间、在线时长、IP 和房间
@author ChatRoom Laravel
@version 1.0.0
--}}
@extends('admin.layouts.app')
@section('title', '在职登录日志 · ' . $userPosition->user->username)
@section('content')
<div class="mb-6">
<a href="{{ route('admin.appointments.index') }}" class="text-sm text-indigo-600 hover:underline"> 返回任命管理</a>
<h2 class="text-lg font-bold text-gray-800 mt-2">
{{ $userPosition->position->icon }} {{ $userPosition->user->username }} · {{ $userPosition->position->name }}
</h2>
<p class="text-sm text-gray-500 mt-1">
任命于 {{ $userPosition->appointed_at->format('Y-m-d') }}
任命人:{{ $userPosition->appointedBy?->username ?? '系统' }}
</p>
</div>
{{-- 统计摘要 --}}
<div class="grid grid-cols-3 gap-4 mb-6">
<div class="bg-white rounded-xl p-5 border shadow-sm text-center">
<div class="text-2xl font-bold text-indigo-600">{{ $logs->total() }}</div>
<div class="text-xs text-gray-500 mt-1">总登录次数</div>
</div>
<div class="bg-white rounded-xl p-5 border shadow-sm text-center">
<div class="text-2xl font-bold text-green-600">
{{ gmdate('H', $logs->sum('duration_seconds')) }}h {{ gmdate('i', $logs->sum('duration_seconds')) }}m
</div>
<div class="text-xs text-gray-500 mt-1">累计在线时长(当前页)</div>
</div>
<div class="bg-white rounded-xl p-5 border shadow-sm text-center">
<div class="text-2xl font-bold text-orange-600">{{ $userPosition->total_rewarded_coins }}</div>
<div class="text-xs text-gray-500 mt-1">在职期间发放金币</div>
</div>
</div>
<div class="bg-white rounded-xl shadow-sm border overflow-hidden">
<table class="w-full text-sm">
<thead class="bg-gray-50 text-gray-600 text-xs">
<tr>
<th class="px-4 py-3 text-left">登录时间</th>
<th class="px-4 py-3 text-left">退出时间</th>
<th class="px-4 py-3 text-center">在线时长</th>
<th class="px-4 py-3 text-center">房间</th>
<th class="px-4 py-3 text-left">IP 地址</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-100">
@forelse ($logs as $log)
<tr class="hover:bg-gray-50">
<td class="px-4 py-3 text-gray-700">{{ $log->login_at->format('m-d H:i:s') }}</td>
<td class="px-4 py-3 text-gray-500">{{ $log->logout_at?->format('m-d H:i:s') ?? '在线中...' }}</td>
<td class="px-4 py-3 text-center">
@if ($log->duration_seconds)
<span
class="text-xs bg-blue-100 text-blue-700 px-2 py-0.5 rounded">{{ $log->formatted_duration }}</span>
@else
<span class="text-xs text-gray-400"></span>
@endif
</td>
<td class="px-4 py-3 text-center text-gray-500">{{ $log->room_id ? "房间#{$log->room_id}" : '—' }}
</td>
<td class="px-4 py-3 text-gray-400 font-mono text-xs">{{ $log->ip_address }}</td>
</tr>
@empty
<tr>
<td colspan="5" class="px-4 py-12 text-center text-gray-400">暂无登录记录</td>
</tr>
@endforelse
</tbody>
</table>
</div>
<div class="mt-4">{{ $logs->links() }}</div>
@endsection