功能:用户列表增加在线状态列,支持点击排序

- UserManagerController 注入 ChatStateService,从 Redis 聚合
  所有活跃房间在线用户名(跨房间去重)
- 排序白名单加入 'online',在线排序用 orderByRaw CASE WHEN 虚拟列
  desc = 在线用户优先显示,asc = 离线用户优先
- 视图表头加「在线 ↕」可排序列(绿色高亮箭头)
- 每行显示绿色实心点+「在线」/灰点+「离线」小徽章
- my-duty-logs 分页已有 paginate(30)+withQueryString+links(),无需改动
This commit is contained in:
2026-03-01 12:54:34 +08:00
parent 0dff79dd51
commit 2947f0f741
2 changed files with 44 additions and 6 deletions
+17 -1
View File
@@ -67,6 +67,11 @@
</a>
</th>
<th class="p-4">注册时间</th>
<th class="p-4">
<a href="{{ $sortLink('online') }}" class="hover:text-green-600 flex items-center gap-1">
在线<span class="text-green-500">{{ $arrow('online') }}</span>
</a>
</th>
<th class="p-4 text-right">管理操作</th>
</tr>
</thead>
@@ -114,6 +119,16 @@
</td>
<td class="p-4 text-sm font-mono text-gray-500">{{ $user->created_at->format('Y/m/d H:i') }}
</td>
<td class="p-4">
@php $isOnline = $onlineUsernames->contains($user->username); @endphp
<span
class="inline-flex items-center gap-1.5 text-xs font-bold px-2 py-0.5 rounded-full
{{ $isOnline ? 'bg-green-100 text-green-700' : 'bg-gray-100 text-gray-400' }}">
<span
class="w-1.5 h-1.5 rounded-full {{ $isOnline ? 'bg-green-500' : 'bg-gray-300' }}"></span>
{{ $isOnline ? '在线' : '离线' }}
</span>
</td>
<td class="p-4 text-right space-x-2 relative">
<button
@click="editingUser = {
@@ -182,7 +197,8 @@
{{-- 经验 --}}
<div>
<label class="block text-xs font-bold text-gray-600 mb-1">经验值</label>
<input type="number" name="exp_num" x-model="editingUser.exp_num" required min="0"
<input type="number" name="exp_num" x-model="editingUser.exp_num" required
min="0"
class="w-full border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 p-2 border text-sm">
</div>
{{-- 金币 --}}