0 ? hosting_plan_get($id) : null; // 处理 POST 保存 if ($_SERVER['REQUEST_METHOD'] === 'POST' && ($_POST['act'] ?? '') === 'save') { $data = [ 'id' => $id, 'name' => $_POST['name'] ?? '', 'description' => $_POST['description'] ?? '', 'category' => $_POST['category'] ?? '', 'node' => $_POST['node'] ?? '', 'spec_web' => (int)($_POST['spec_web'] ?? 0), 'spec_sql' => (int)($_POST['spec_sql'] ?? 0), 'spec_flow' => (int)($_POST['spec_flow'] ?? 0), 'spec_domain' => (int)($_POST['spec_domain'] ?? 0), 'enabled_periods' => isset($_POST['enabled_periods']) && is_array($_POST['enabled_periods']) ? $_POST['enabled_periods'] : [], 'status' => $_POST['status'] ?? 'active', 'sort' => (int)($_POST['sort'] ?? 50), ]; foreach (hosting_periods() as $p => $cfg) { $field = hosting_period_price_field($p); $data[$field] = (int)round((float)($_POST['price'][$p] ?? 0) * 100); } $r = hosting_plan_save($data); if ($r === true) { header('Location: ' . hosting_admin_url('plans')); exit; } $msg = $r; $msg_type = 'danger'; // 保留用户输入 $plan = $data; } $title = $title ?? ($plan && $id > 0 ? '编辑套餐' : '新增套餐'); mnbt_admin_include('head'); ?>

0 ? '编辑套餐' : '新增套餐' ?>

返回列表
没有需要的分类?请前往套餐分类页面添加。
$cfg): $field = hosting_period_price_field($p); $checked = in_array($p, $enabledPeriods, true) ? 'checked' : ''; $price = isset($plan[$field]) ? hosting_format_cents((int)$plan[$field]) : '0.00'; ?>
>
勾选并填写价格即启用该周期;价格填 0 表示免费。
取消