修复无法正常邀请成员的问题
Signed-off-by: vilson <545522390@qq.com>
This commit is contained in:
parent
5e5fc37f76
commit
d79706481a
@ -37,29 +37,35 @@ class Auth
|
|||||||
if ($currentOrganizationCode) {
|
if ($currentOrganizationCode) {
|
||||||
setCurrentOrganizationCode($currentOrganizationCode);
|
setCurrentOrganizationCode($currentOrganizationCode);
|
||||||
}
|
}
|
||||||
|
$authorization = $request->header('Authorization');
|
||||||
|
$logined = false;
|
||||||
|
$encodeData = '';
|
||||||
|
if ($authorization) {
|
||||||
|
$accessToken = explode(' ', $authorization)[1];
|
||||||
|
$encodeData = JwtService::decodeToken($accessToken);
|
||||||
|
if (!isError($encodeData)) {
|
||||||
|
$member = Cache::get('member:info:' . $encodeData->data->code);
|
||||||
|
if ($member) {
|
||||||
|
setCurrentMember($member);
|
||||||
|
$logined = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// 登录状态检查
|
// 登录状态检查
|
||||||
if (!empty($access['is_login'])) {
|
if (!empty($access['is_login'])) {
|
||||||
$authorization = $request->header('Authorization');
|
if (isError($encodeData)) {
|
||||||
$accessToken = '';
|
|
||||||
if ($authorization) {
|
|
||||||
$accessToken = explode(' ', $authorization)[1];
|
|
||||||
}
|
|
||||||
$data = JwtService::decodeToken($accessToken);
|
|
||||||
if (isError($data)) {
|
|
||||||
//TODO 启用refreshToken
|
//TODO 启用refreshToken
|
||||||
if ($data['errno'] == 3) {
|
if ($encodeData['errno'] == 3) {
|
||||||
$msg = ['code' => 401, 'msg' => 'accessToken过期'];
|
$msg = ['code' => 401, 'msg' => 'accessToken过期'];
|
||||||
return json($msg);
|
return json($msg);
|
||||||
}
|
}
|
||||||
$msg = ['code' => 401, 'msg' => '登录超时,请重新登录'];
|
$msg = ['code' => 401, 'msg' => '登录超时,请重新登录'];
|
||||||
return json($msg);
|
return json($msg);
|
||||||
}
|
}
|
||||||
$member = Cache::get('member:info:' . $data->data->code);
|
if (!$logined) {
|
||||||
if (!$member) {
|
|
||||||
$msg = ['code' => 401, 'msg' => '登录超时,请重新登录'];
|
$msg = ['code' => 401, 'msg' => '登录超时,请重新登录'];
|
||||||
return json($msg);
|
return json($msg);
|
||||||
}
|
}
|
||||||
setCurrentMember($member);
|
|
||||||
}
|
}
|
||||||
// 访问权限检查
|
// 访问权限检查
|
||||||
if (!empty($access['is_auth']) && !auth($node, 'project')) {
|
if (!empty($access['is_auth']) && !auth($node, 'project')) {
|
||||||
@ -74,7 +80,7 @@ class Auth
|
|||||||
foreach ($config as $itemKey => $item) {
|
foreach ($config as $itemKey => $item) {
|
||||||
sysconf($itemKey, $item);
|
sysconf($itemKey, $item);
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
sysconf($key, $config);
|
sysconf($key, $config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user