增强:完善用户考勤记录机制,增加进出房间时间和登录次数统计
This commit is contained in:
@@ -51,6 +51,9 @@ class ChatController extends Controller
|
||||
|
||||
// 房间人气 +1(每次访问递增,复刻原版人气计数)
|
||||
$room->increment('visit_num');
|
||||
|
||||
// 用户进房时间刷新
|
||||
$user->update(['in_time' => now()]);
|
||||
|
||||
// 1. 将当前用户加入到 Redis 房间在线列表(包含 VIP 和管理员信息)
|
||||
$superLevel = (int) Sysparam::getValue('superlevel', '100');
|
||||
@@ -319,6 +322,12 @@ class ChatController extends Controller
|
||||
// 1. 从 Redis 删除该用户
|
||||
$this->chatState->userLeave($id, $user->username);
|
||||
|
||||
// 记录退出时间和退出信息
|
||||
$user->update([
|
||||
'out_time' => now(),
|
||||
'out_info' => "正常退出了房间",
|
||||
]);
|
||||
|
||||
// 2. 广播通知他人
|
||||
broadcast(new UserLeft($id, $user->username))->toOthers();
|
||||
|
||||
@@ -356,7 +365,7 @@ class ChatController extends Controller
|
||||
*/
|
||||
public function changeAvatar(Request $request): JsonResponse
|
||||
{
|
||||
$user = auth()->user();
|
||||
$user = Auth::user();
|
||||
$headface = $request->input('headface', '');
|
||||
|
||||
if (empty($headface)) {
|
||||
|
||||
Reference in New Issue
Block a user