getPdo(); $pdo->prepare( "INSERT INTO preliminary_data (source_type, company_name, person_name, contact_phone, contact_email, target_product_category, description, source_channel, recorded_by, status) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, '待处理')" )->execute([ $sourceType, $companyName !== '' ? $companyName : null, $personName !== '' ? $personName : null, $phone !== '' ? $phone : null, $email !== '' ? $email : null, $category !== '' ? $category : null, $description !== '' ? $description : null, $sourceChannel, $_SESSION['username'] ?? null, ]); $newId = (int)$pdo->lastInsertId(); logCurrent('add', 'fragment', 'preliminary_data', $newId, [ 'source_type' => $sourceType, 'company_name' => $companyName, 'person_name' => $personName, 'phone' => $phone, 'email' => $email, ]); Response::success(['id' => $newId], '新增成功');