Files
superlink/api/channel/plan_delete.php
T

24 lines
661 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
/**
* 渠道新增计划删除接口 POST /api/channel/plan_delete.php
* 入参:id(必填);软删除(is_active = 0)
*/
require_once __DIR__ . '/../common/Api.php';
$pdo = Api::boot(['module' => 'channel']);
$id = (int)($_POST['id'] ?? 0);
if ($id <= 0) {
Response::error('参数错误', 400);
}
$pdo = DB::getInstance()->getPdo();
$stmt = $pdo->prepare("UPDATE channel_plans SET is_active = 0 WHERE id = ?");
$stmt->execute([$id]);
if ($stmt->rowCount() === 0) {
Response::error('计划不存在');
}
logCurrent('delete', 'channel_plan', 'channel_plans', $id, ['soft_delete' => true]);
Response::success(null, '删除成功');