device ana

This commit is contained in:
2025-04-02 20:18:08 +08:00
parent a6f7172ec4
commit 0f8419778c
2 changed files with 13 additions and 1 deletions

View File

@@ -6,10 +6,19 @@ export async function GET(request: NextRequest) {
try { try {
const searchParams = request.nextUrl.searchParams; const searchParams = request.nextUrl.searchParams;
// 获取团队、项目和标签筛选参数
const teamIds = searchParams.getAll('teamId');
const projectIds = searchParams.getAll('projectId');
const tagIds = searchParams.getAll('tagId');
const data = await getDeviceAnalytics({ const data = await getDeviceAnalytics({
startTime: searchParams.get('startTime') || undefined, startTime: searchParams.get('startTime') || undefined,
endTime: searchParams.get('endTime') || undefined, endTime: searchParams.get('endTime') || undefined,
linkId: searchParams.get('linkId') || undefined linkId: searchParams.get('linkId') || undefined,
// 添加团队、项目和标签筛选
teamIds: teamIds.length > 0 ? teamIds : undefined,
projectIds: projectIds.length > 0 ? projectIds : undefined,
tagIds: tagIds.length > 0 ? tagIds : undefined
}); });
const response: ApiResponse<typeof data> = { const response: ApiResponse<typeof data> = {

View File

@@ -245,6 +245,9 @@ export async function getDeviceAnalytics(params: {
startTime?: string; startTime?: string;
endTime?: string; endTime?: string;
linkId?: string; linkId?: string;
teamIds?: string[];
projectIds?: string[];
tagIds?: string[];
}): Promise<DeviceAnalytics> { }): Promise<DeviceAnalytics> {
const filter = buildFilter(params); const filter = buildFilter(params);