28 lines
802 B
PHP
28 lines
802 B
PHP
<?php
|
||
/**
|
||
* 渠道新增计划删除接口 POST /api/channel/plan_delete.php
|
||
* 入参:id(必填);软删除(is_active = 0)
|
||
*/
|
||
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('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, '删除成功');
|