diff --git a/index.php b/index.php index 68a96ed..b914e87 100644 --- a/index.php +++ b/index.php @@ -13,16 +13,23 @@ if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') { // 定义文件路径 $authFilePath = 'auth.json'; -// 忽略请求路径和查询参数,直接返回auth.json文件内容 -// 无论访问路径是什么,都返回相同的固定JSON响应 +// 从请求中获取token参数 +$requestToken = isset($_GET['token']) ? $_GET['token'] : null; + +// 检查auth.json文件是否存在 if (file_exists($authFilePath)) { // 读取JSON文件内容 $jsonContent = file_get_contents($authFilePath); // 验证JSON格式是否正确 - if ($jsonContent && json_decode($jsonContent) !== null) { - // 直接输出JSON内容 - echo $jsonContent; + if ($jsonContent && ($jsonData = json_decode($jsonContent, true)) !== null) { + // 如果请求中包含token参数,则替换auth.json中的token + if ($requestToken && isset($jsonData['data']['Token'])) { + $jsonData['data']['Token'] = $requestToken; + } + + // 输出更新后的JSON内容 + echo json_encode($jsonData, JSON_UNESCAPED_UNICODE); exit; } else { // JSON格式错误时的响应 diff --git a/url.txt b/url.txt deleted file mode 100644 index a376441..0000000 --- a/url.txt +++ /dev/null @@ -1 +0,0 @@ -http://wangpu.baison.com.cn/api/sys/devicereg/getaccreditinfo3000j?from=1&tenantcode=0×tamp=20251125170440&token=82DBFF99-D114-4DBD-85E5-3AEE1004A857&version=3.0.3 \ No newline at end of file