diff --git a/src/app/api/cron/route.ts b/src/app/api/cron/route.ts index f416581..0936458 100644 --- a/src/app/api/cron/route.ts +++ b/src/app/api/cron/route.ts @@ -1,6 +1,5 @@ /* eslint-disable no-console,@typescript-eslint/no-explicit-any */ -import * as crypto from 'crypto'; import { NextRequest, NextResponse } from 'next/server'; import { getConfig, refineConfig } from '@/lib/config'; @@ -145,21 +144,21 @@ async function refreshRecordAndFavorites() { }; // 并发限制工具 - async function runWithConcurrency( + const runWithConcurrency = async ( tasks: (() => Promise)[], concurrency: number - ): Promise { + ): Promise => { const results: T[] = []; let index = 0; - async function worker() { + const worker = async () => { while (index < tasks.length) { const i = index++; results[i] = await tasks[i](); } - } + }; await Promise.all(Array.from({ length: Math.min(concurrency, tasks.length) }, () => worker())); return results; - } + }; // 处理单个用户的播放记录和收藏 const processUser = async (user: string) => { diff --git a/src/app/api/search/resources/route.ts b/src/app/api/search/resources/route.ts index beed1cb..58acb9b 100644 --- a/src/app/api/search/resources/route.ts +++ b/src/app/api/search/resources/route.ts @@ -1,6 +1,7 @@ /* eslint-disable no-console */ import { NextRequest, NextResponse } from 'next/server'; + import { getAuthInfoFromCookie } from '@/lib/auth'; import { getAvailableApiSites } from '@/lib/config';