fetch( "SELECT id, api_key FROM {$db->table('projects')} WHERE api_key = ? AND status = 1 AND deleted_at IS NULL", [$apiKey] ); if (!$project) { Application::jsonResponse(403, 'API密钥无效或项目已禁用', null, 403); } $_SERVER['HTTP_X_PROJECT_ID'] = $project['id']; return $next($request); } }