增加Token有效期

This commit is contained in:
=
2022-02-24 18:36:49 +01:00
parent 2e9764f1b4
commit 8be373cd8b
9 changed files with 197 additions and 56 deletions

View File

@@ -58,8 +58,8 @@ function check_api($token)
exit(json_encode($reJson, JSON_UNESCAPED_UNICODE));
}
if (!in_array($token, $tokenList)) {
// Token错误 Token错误
if (!in_array($tokenList[$token], $tokenList)) {
// Token 是否存在
$reJson = array(
"result" => 'failed',
'code' => 202,
@@ -67,4 +67,14 @@ function check_api($token)
);
exit(json_encode($reJson, JSON_UNESCAPED_UNICODE));
}
if ($tokenList[$token]['expired'] < time()) {
// Token 是否过期
$reJson = array(
"result" => 'failed',
'code' => 203,
'message' => 'Token Expired',
);
exit(json_encode($reJson, JSON_UNESCAPED_UNICODE));
}
}