|
|
@@ -27,16 +27,17 @@ const SystemSetting = () => {
|
|
|
TurnstileSecretKey: '',
|
|
|
RegisterEnabled: '',
|
|
|
QuotaForNewUser: 0,
|
|
|
+ QuotaRemindThreshold: 0,
|
|
|
ModelRatio: '',
|
|
|
TopUpLink: '',
|
|
|
AutomaticDisableChannelEnabled: '',
|
|
|
ChannelDisableThreshold: 0,
|
|
|
});
|
|
|
- let originInputs = {};
|
|
|
+ const [originInputs, setOriginInputs] = useState({});
|
|
|
let [loading, setLoading] = useState(false);
|
|
|
|
|
|
const getOptions = async () => {
|
|
|
- const res = await API.get('/api/option');
|
|
|
+ const res = await API.get('/api/option/');
|
|
|
const { success, message, data } = res.data;
|
|
|
if (success) {
|
|
|
let newInputs = {};
|
|
|
@@ -44,7 +45,7 @@ const SystemSetting = () => {
|
|
|
newInputs[item.key] = item.value;
|
|
|
});
|
|
|
setInputs(newInputs);
|
|
|
- originInputs = newInputs;
|
|
|
+ setOriginInputs(newInputs);
|
|
|
} else {
|
|
|
showError(message);
|
|
|
}
|
|
|
@@ -70,7 +71,7 @@ const SystemSetting = () => {
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
- const res = await API.put('/api/option', {
|
|
|
+ const res = await API.put('/api/option/', {
|
|
|
key,
|
|
|
value
|
|
|
});
|
|
|
@@ -96,6 +97,7 @@ const SystemSetting = () => {
|
|
|
name === 'TurnstileSiteKey' ||
|
|
|
name === 'TurnstileSecretKey' ||
|
|
|
name === 'QuotaForNewUser' ||
|
|
|
+ name === 'QuotaRemindThreshold' ||
|
|
|
name === 'ModelRatio' ||
|
|
|
name === 'TopUpLink'
|
|
|
) {
|
|
|
@@ -114,6 +116,9 @@ const SystemSetting = () => {
|
|
|
if (originInputs['QuotaForNewUser'] !== inputs.QuotaForNewUser) {
|
|
|
await updateOption('QuotaForNewUser', inputs.QuotaForNewUser);
|
|
|
}
|
|
|
+ if (originInputs['QuotaRemindThreshold'] !== inputs.QuotaRemindThreshold) {
|
|
|
+ await updateOption('QuotaRemindThreshold', inputs.QuotaRemindThreshold);
|
|
|
+ }
|
|
|
if (originInputs['ModelRatio'] !== inputs.ModelRatio) {
|
|
|
if (!verifyJSON(inputs.ModelRatio)) {
|
|
|
showError('模型倍率不是合法的 JSON 字符串');
|
|
|
@@ -287,6 +292,16 @@ const SystemSetting = () => {
|
|
|
type='link'
|
|
|
placeholder='例如发卡网站的购买链接'
|
|
|
/>
|
|
|
+ <Form.Input
|
|
|
+ label='额度提醒阈值'
|
|
|
+ name='QuotaRemindThreshold'
|
|
|
+ onChange={handleInputChange}
|
|
|
+ autoComplete='new-password'
|
|
|
+ value={inputs.QuotaRemindThreshold}
|
|
|
+ type='number'
|
|
|
+ min='0'
|
|
|
+ placeholder='低于此额度时将发送邮件提醒用户'
|
|
|
+ />
|
|
|
</Form.Group>
|
|
|
<Form.Group widths='equal'>
|
|
|
<Form.TextArea
|