From 7afd5b1d5e6d73d0264f0cfe7b420ca9fd89ed32 Mon Sep 17 00:00:00 2001 From: wwwwwwwww <526125649@qq.com> Date: Wed, 22 Jul 2026 09:59:27 +0800 Subject: [PATCH] 1 --- video-gen-admin/src/pages/AdminSettings.tsx | 66 ++++++++----------- video-gen-app/dist/index.html | 70 ++++++++++----------- 2 files changed, 60 insertions(+), 76 deletions(-) diff --git a/video-gen-admin/src/pages/AdminSettings.tsx b/video-gen-admin/src/pages/AdminSettings.tsx index e36bf6d1..e1ab20d0 100644 --- a/video-gen-admin/src/pages/AdminSettings.tsx +++ b/video-gen-admin/src/pages/AdminSettings.tsx @@ -1,9 +1,9 @@ import React, { useEffect, useState } from 'react'; import { - Button, Card, Form, Input, InputNumber, Modal, message, Select, Space, Switch, Tabs, Typography, Upload, + Button, Card, Form, Input, InputNumber, message, Select, Space, Switch, Tabs, Typography, Upload, } from 'antd'; import { - SettingOutlined, SaveOutlined, UploadOutlined, FilePdfOutlined, EyeOutlined, DatabaseOutlined, PlusOutlined, VideoCameraOutlined, RobotOutlined, + SettingOutlined, SaveOutlined, UploadOutlined, FilePdfOutlined, EyeOutlined, DatabaseOutlined, VideoCameraOutlined, RobotOutlined, } from '@ant-design/icons'; import { createSystemConfig, @@ -28,8 +28,6 @@ const AdminSettings: React.FC = () => { const [loading, setLoading] = useState(true); const [saving, setSaving] = useState(false); const [uploading, setUploading] = useState(''); - const [addModalOpen, setAddModalOpen] = useState(false); - const [addForm] = Form.useForm(); const [form] = Form.useForm(); useEffect(() => { @@ -50,6 +48,8 @@ const AdminSettings: React.FC = () => { setConfigs(data); const formValues: Record = {}; data.forEach(c => { formValues[c.key] = c.value; }); + // 预扣积分默认值 + if (!formValues.optimize_hold_credits) formValues.optimize_hold_credits = '5'; formValues.resource_capacity_enabled = capacity.enabled; formValues.resource_capacity_limit_value = capacity.limitValue || '1.000'; formValues.resource_capacity_limit_unit = capacity.limitUnit || 'GB'; @@ -71,6 +71,18 @@ const AdminSettings: React.FC = () => { await updateSystemConfig(config.id, String(newVal ?? '')); } } + // AI创作预扣积分 - 不存在则创建 + const holdVal = values.optimize_hold_credits; + if (holdVal !== undefined && holdVal !== null && holdVal !== '') { + const existing = configs.find(c => c.key === 'optimize_hold_credits'); + if (existing) { + if (String(holdVal) !== existing.value) { + await updateSystemConfig(existing.id, String(holdVal)); + } + } else { + await createSystemConfig('optimize_hold_credits', String(holdVal), 'AI创作预扣积分数量(防止并发超卖)'); + } + } await saveGlobalResourceCapacity({ enabled: !!values.resource_capacity_enabled, limitValue: String(values.resource_capacity_limit_value ?? '1.000'), @@ -333,20 +345,6 @@ const AdminSettings: React.FC = () => { return ; }; - const handleAddConfig = async () => { - try { - const values = await addForm.validateFields(); - const res = await createSystemConfig(values.key, values.value, values.description || ''); - setConfigs(prev => [...prev, res]); - form.setFieldsValue({ [res.key]: res.value }); - setAddModalOpen(false); - addForm.resetFields(); - message.success('配置已添加'); - } catch (e: any) { - message.error(e?.message || '添加失败'); - } - }; - if (loading) { return ; } @@ -402,6 +400,14 @@ const AdminSettings: React.FC = () => { {getFieldComponent(config)} ))} + {/* AI创作预扣积分 - 固定显示 */} + AI创作预扣积分数量} + extra="AI创作时预扣积分数量,用于防止并发超卖。预扣后按实际消耗多退少补" + > + + ), @@ -536,34 +542,12 @@ const AdminSettings: React.FC = () => { -
- +
- - { setAddModalOpen(false); addForm.resetFields(); }} - okText="添加" - cancelText="取消" - > -
- - - - - - - - - -
-
); }; diff --git a/video-gen-app/dist/index.html b/video-gen-app/dist/index.html index ab864b0a..ac72c57f 100644 --- a/video-gen-app/dist/index.html +++ b/video-gen-app/dist/index.html @@ -1,37 +1,37 @@ - - - - - - - - - - 民众智创 - + + + + + + + + + + 民众智创 + - - -
- - + + +
+ +