修改时间范围组件,评查详情创建新的数据结构来适配新的返回格式

This commit is contained in:
2025-04-22 20:49:18 +08:00
parent cd2f060d87
commit 6261950356
14 changed files with 678 additions and 299 deletions
+26 -3
View File
@@ -17,6 +17,29 @@ export interface PostgrestParams {
headers?: Record<string, string>;
}
/**
* 将编码后的URL解码为可读格式
* @param url 编码后的URL
* @returns 解码后的可读URL
*/
function decodeUrlForDisplay(url: string): string {
try {
// 首先解码整个URL
const decodedUrl = decodeURIComponent(url);
// 如果URL中包含@符号作为前缀,则移除它
if (decodedUrl.startsWith('@')) {
return decodedUrl.substring(1);
}
return decodedUrl;
} catch (error) {
// 如果解码失败,返回原始URL
console.error('URL解码失败:', error);
return url;
}
}
/**
* 打印 PostgREST 查询日志
* @param endpoint 端点
@@ -32,9 +55,9 @@ function logPostgrestQuery(endpoint: string, params?: QueryParams, method: strin
// 确保 endpoint 格式正确
const normalizedEndpoint = endpoint.startsWith('/') ? endpoint.substring(1) : endpoint;
console.log('\n📦 PostgREST 查询日志 ========================');
console.log('\n📦 PostgREST 查询日志 ======================start=============');
console.log(`📦 HTTP 方法: ${method}`);
console.log(`📦 API 端点: ${baseUrl}/${normalizedEndpoint}`);
console.log(`📦 API 端点: ${decodeUrlForDisplay(`${baseUrl}/${normalizedEndpoint}`)}`);
if (params && Object.keys(params).length > 0) {
console.log('📦 查询参数:');
@@ -47,7 +70,7 @@ function logPostgrestQuery(endpoint: string, params?: QueryParams, method: strin
});
}
console.log('=========================================\n');
console.log('PostgREST 查询日志=============================end============\n');
}
}