fix(WebSocket): 修正成员ID验证并临时放宽认证参数检查

修正WebSocket连接中成员ID验证使用错误变量的问题,将$member_id改为$user_id
同时临时放宽认证参数检查,仅验证site_id,为后续配置调整做准备
This commit is contained in:
2026-01-21 17:03:37 +08:00
parent f2d5ce1d7b
commit 266f810508
2 changed files with 5 additions and 2 deletions

View File

@@ -195,7 +195,7 @@ class WebSocket extends WebSocketBase
}
// member_id 必须一致,避免冒用
if ((int)$data['member_id'] !== $member_id) {
if ((int)$data['member_id'] !== $user_id) {
throw new \Exception('TOKEN_ERROR');
}

View File

@@ -149,7 +149,10 @@ abstract class WebSocketBase implements MessageComponentInterface
$user_id = $data['user_id'] ?? null;
$token = $data['token'] ?? null;
if (empty($site_id) || empty($user_id) || empty($token)) {
// 暂时开放使用,后期根据配置或者实际需要,需要对其他参数进行验证
if (empty($site_id)
// || empty($user_id) || empty($token)
) {
throw new \Exception('Missing authentication parameters');
}