'need']); $id = (int)($_POST['id'] ?? 0); $ids = trim($_POST['ids'] ?? ''); $idList = []; if ($id > 0) $idList[] = $id; if ($ids !== '') { foreach (explode(',', $ids) as $v) { $v = (int)trim($v); if ($v > 0) $idList[] = $v; } } $idList = array_unique($idList); if (!$idList) { Response::error('参数错误', 400); } $pdo = DB::getInstance()->getPdo(); $in = implode(',', array_fill(0, count($idList), '?')); $stmt = $pdo->prepare("UPDATE company_needs SET is_valid = 0 WHERE id IN ($in)"); $stmt->execute($idList); $affected = $stmt->rowCount(); logCurrent('delete', 'need', 'company_needs', null, ['ids' => $idList]); Response::success(['affected' => $affected], "已作废 $affected 条需求");