调整ä功能
This commit is contained in:
@@ -74,16 +74,16 @@ class WsEvents
|
||||
}
|
||||
|
||||
// 连接是否满足条件
|
||||
// if ($payload['server']['HTTP_ORIGIN'] != 'https://wstool.js.org') {
|
||||
// flg('[x] [TOKEN认证] HTTP_ORIGIN不满足条件', false);
|
||||
// Gateway::sendToClient($client_id, WsResponse::error(
|
||||
// 'system.auth',
|
||||
// 1001,
|
||||
// '[x] [TOKEN认证] HTTP_ORIGIN不满足条件'
|
||||
// ));
|
||||
// Gateway::closeClient($client_id);
|
||||
// return;
|
||||
// }
|
||||
if (getenv('ENVIRONMENT') === 'master' && $payload['server']['HTTP_ORIGIN'] === getenv('MAIN_DOMAIN')) {
|
||||
flg('[x] [TOKEN认证] HTTP_ORIGIN不满足条件', false);
|
||||
Gateway::sendToClient($client_id, WsResponse::error(
|
||||
'system.auth',
|
||||
1001,
|
||||
'[x] [TOKEN认证] HTTP_ORIGIN不满足条件'
|
||||
));
|
||||
Gateway::closeClient($client_id);
|
||||
return;
|
||||
}
|
||||
|
||||
// 签名检查
|
||||
if (!isset($payload['get']['token'])) {
|
||||
@@ -99,9 +99,14 @@ class WsEvents
|
||||
|
||||
// 解析TOKEN
|
||||
$user = (new Jwt())->verifyToken($payload['get']['token']);
|
||||
|
||||
// 绑定用户ID
|
||||
Gateway::bindUid($client_id, $user->uid);
|
||||
|
||||
// 绑定SESSION
|
||||
$_SESSION['uid'] = $user->uid;
|
||||
$_SESSION['name'] = $user->uname;
|
||||
|
||||
// 响应
|
||||
Gateway::sendToClient($client_id, WsResponse::success(
|
||||
'system.auth',
|
||||
@@ -119,6 +124,13 @@ class WsEvents
|
||||
}
|
||||
}
|
||||
|
||||
public function logout(string $client_id)
|
||||
{
|
||||
if ($_SESSION !== null) {
|
||||
var_dump($_SESSION);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统心跳
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user