feat: add system params persistence and delivery gate enforcement

V25 migration creates platform_system_param table. SystemParamController replaces localStorage MVP with backend persistence. LicenseSnService.create now checks deliveryGateEnabled flag and blocks SN creation when gate is on but no deliveries completed.

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-05-27 08:37:02 +08:00
parent 8c167d4909
commit 5d50d2819b
6 changed files with 138 additions and 22 deletions
@@ -1,31 +1,25 @@
<script setup>
import { ref, onMounted } from 'vue'
import { ElMessage } from 'element-plus'
import axios from 'axios'
const params = ref({
orphanSnStrictValidation: true,
deliveryGateEnabled: true,
sessionTimeoutMinutes: 60,
passwordMinLength: 6,
})
const params = ref({})
const loading = ref(false)
async function loadParams() {
try {
const stored = localStorage.getItem('systemParams')
if (stored) {
params.value = { ...params.value, ...JSON.parse(stored) }
}
const { data } = await axios.get('/api/v1/system-params')
params.value = { ...data }
} catch {
ElMessage.error('加载系统参数失败')
}
}
async function saveParams() {
loading.value = true
try {
localStorage.setItem('systemParams', JSON.stringify(params.value))
ElMessage.success('参数已保存MVP: 存储于浏览器本地)')
await axios.put('/api/v1/system-params', params.value)
ElMessage.success('参数已保存')
} catch (e) {
ElMessage.error('保存失败')
} finally {
@@ -42,10 +36,10 @@ onMounted(loadParams)
<el-card shadow="never" style="margin-top:16px;max-width:560px">
<el-form label-width="200px" label-position="left">
<el-form-item label="孤儿 SN 严格校验">
<el-switch v-model="params.orphanSnStrictValidation" />
<el-switch v-model="params.orphanSnStrictValidation" active-value="true" inactive-value="false" />
</el-form-item>
<el-form-item label="交付闸门启用">
<el-switch v-model="params.deliveryGateEnabled" />
<el-switch v-model="params.deliveryGateEnabled" active-value="true" inactive-value="false" />
</el-form-item>
<el-form-item label="会话超时(分钟)">
<el-input-number v-model="params.sessionTimeoutMinutes" :min="5" :max="1440" />