getPdo(); $chk = $pdo->prepare("SELECT COUNT(*) FROM companies WHERE id = ?"); $chk->execute([$companyId]); if ((int)$chk->fetchColumn() === 0) { Response::error('企业不存在'); } $stmt = $pdo->prepare("SELECT COUNT(*) FROM company_products WHERE company_id = ? AND is_active = 1"); $stmt->execute([$companyId]); $total = (int)$stmt->fetchColumn(); $offset = ($page - 1) * $limit; $stmt = $pdo->prepare( "SELECT id, category_name, category_description, is_core, is_active FROM company_products WHERE company_id = ? AND is_active = 1 ORDER BY is_core DESC, id DESC LIMIT $limit OFFSET $offset" ); $stmt->execute([$companyId]); Response::success(['list' => $stmt->fetchAll(), 'total' => $total, 'page' => $page, 'limit' => $limit]);