c86f08c325
Co-Authored-By: Claude Code <noreply@anthropic.com>
30 lines
873 B
PHP
30 lines
873 B
PHP
<?php
|
|
/**
|
|
* 硬碎片详情接口 GET /api/fragment/hard_detail.php?id=1
|
|
*/
|
|
require_once __DIR__ . '/../common/Api.php';
|
|
$pdo = Api::boot(['module' => 'preliminary']);
|
|
require_once __DIR__ . '/hard_common.php';
|
|
|
|
|
|
$id = (int)($_REQUEST['id'] ?? 0);
|
|
if ($id <= 0) {
|
|
Response::error('参数错误', 400);
|
|
}
|
|
|
|
$pdo = DB::getInstance()->getPdo();
|
|
$stmt = $pdo->prepare("SELECT * FROM preliminary_data WHERE id = ?");
|
|
$stmt->execute([$id]);
|
|
$row = $stmt->fetch();
|
|
if (!$row) {
|
|
Response::error('碎片不存在');
|
|
}
|
|
|
|
$calc = hardCompleteness($row);
|
|
$row['completeness'] = $calc['score'];
|
|
$row['missing'] = $calc['missing'];
|
|
$row['summary'] = hardSummary($row);
|
|
$row['source_type_label'] = ['company' => '企业', 'person' => '人员', 'product' => '产品', 'need' => '需求', 'mixed' => '混合'][$row['source_type']] ?? $row['source_type'];
|
|
|
|
Response::success($row);
|