36 lines
1.1 KiB
PHP
36 lines
1.1 KiB
PHP
<?php
|
|
/**
|
|
* 硬碎片废弃接口 POST /api/fragment/hard_discard.php
|
|
* 入参:id
|
|
* v1.0.50:废弃改为从 preliminary_data 彻底硬删除(不再保留记录)
|
|
*/
|
|
require_once __DIR__ . '/../common/db.php';
|
|
require_once __DIR__ . '/../common/response.php';
|
|
require_once __DIR__ . '/../common/auth.php';
|
|
require_once __DIR__ . '/../common/logger.php';
|
|
|
|
checkAjax();
|
|
checkPermission('preliminary');
|
|
|
|
$id = (int)($_POST['id'] ?? 0);
|
|
if ($id <= 0) {
|
|
Response::error('参数错误', 400);
|
|
}
|
|
|
|
$pdo = DB::getInstance()->getPdo();
|
|
$stmt = $pdo->prepare("SELECT id, converted_id FROM preliminary_data WHERE id = ? AND is_active = 1");
|
|
$stmt->execute([$id]);
|
|
$frag = $stmt->fetch();
|
|
if (!$frag) {
|
|
Response::error('碎片不存在');
|
|
}
|
|
if ($frag['converted_id']) {
|
|
Response::error('该碎片已转换,不可废弃');
|
|
}
|
|
|
|
// 彻底硬删除(v1.0.50 起废弃不再保留记录)
|
|
$pdo->prepare("DELETE FROM preliminary_data WHERE id = ?")->execute([$id]);
|
|
|
|
logCurrent('discard', 'fragment', 'preliminary_data', $id, ['action' => 'hard_delete']);
|
|
Response::success(null, '已废弃');
|