'preliminary']); require_once __DIR__ . '/hard_common.php'; [$page, $limit] = pageParams(); $keyword = trim($_REQUEST['keyword'] ?? ''); $sourceType = trim($_REQUEST['source_type'] ?? ''); $sourceChannel = trim($_REQUEST['source_channel'] ?? ''); $where = ["is_active = 1", "converted_id IS NULL"]; $params = []; if ($keyword !== '') { $where[] = '(company_name LIKE ? OR person_name LIKE ? OR contact_phone LIKE ? OR contact_email LIKE ? OR description LIKE ?)'; $like = "%$keyword%"; array_push($params, $like, $like, $like, $like, $like); } if ($sourceType !== '') { $where[] = 'source_type = ?'; $params[] = $sourceType; } if ($sourceChannel !== '') { $where[] = 'source_channel = ?'; $params[] = $sourceChannel; } $whereSql = implode(' AND ', $where); $pdo = DB::getInstance()->getPdo(); $stmt = $pdo->prepare("SELECT COUNT(*) FROM preliminary_data WHERE $whereSql"); $stmt->execute($params); $total = (int)$stmt->fetchColumn(); $offset = ($page - 1) * $limit; $stmt = $pdo->prepare( "SELECT id, source_type, company_name, industry, registration_number, business_role, country, address, person_name, contact_phone, contact_email, work_location, id_number, platform, account_id, profile_url, source_channel, recorded_by, follow_person, converted_type, converted_id, created_at, updated_at FROM preliminary_data WHERE $whereSql ORDER BY id DESC LIMIT $limit OFFSET $offset" ); $stmt->execute($params); $rows = $stmt->fetchAll(); $list = []; foreach ($rows as $r) { $calc = hardCompleteness($r); $r['completeness'] = $calc['score']; $r['missing'] = $calc['missing']; $r['summary'] = hardSummary($r); $r['source_type_label'] = ['company' => '企业', 'person' => '人员', 'product' => '产品', 'need' => '需求', 'mixed' => '混合'][$r['source_type']] ?? $r['source_type']; $list[] = $r; } Response::success(['list' => $list, 'total' => $total, 'page' => $page, 'limit' => $limit]);