mirror of
https://github.com/linux-do/new-api.git
synced 2025-09-18 00:16:37 +08:00
feat: 添加回调未开启提示
This commit is contained in:
parent
2d2fec24d0
commit
a6ba1d01d9
@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"one-api/common"
|
"one-api/common"
|
||||||
|
"one-api/constant"
|
||||||
"one-api/model"
|
"one-api/model"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -59,6 +60,7 @@ func GetStatus(c *gin.Context) {
|
|||||||
"data_export_default_time": common.DataExportDefaultTime,
|
"data_export_default_time": common.DataExportDefaultTime,
|
||||||
"default_collapse_sidebar": common.DefaultCollapseSidebar,
|
"default_collapse_sidebar": common.DefaultCollapseSidebar,
|
||||||
"enable_online_topup": common.PayAddress != "" && common.EpayId != "" && common.EpayKey != "",
|
"enable_online_topup": common.PayAddress != "" && common.EpayId != "" && common.EpayKey != "",
|
||||||
|
"mj_notify_enabled": constant.MjNotifyEnabled,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { API, copy, isAdmin, showError, showSuccess, timestamp2string } from '../helpers';
|
import { API, copy, isAdmin, showError, showSuccess, timestamp2string } from '../helpers';
|
||||||
|
|
||||||
import { Button, Form, ImagePreview, Layout, Modal, Progress, Table, Tag, Typography } from '@douyinfe/semi-ui';
|
import { Banner, Button, Form, ImagePreview, Layout, Modal, Progress, Table, Tag, Typography } from '@douyinfe/semi-ui';
|
||||||
import { ITEMS_PER_PAGE } from '../constants';
|
import { ITEMS_PER_PAGE } from '../constants';
|
||||||
|
|
||||||
|
|
||||||
@ -289,6 +289,7 @@ const LogsTable = () => {
|
|||||||
const [logType, setLogType] = useState(0);
|
const [logType, setLogType] = useState(0);
|
||||||
const isAdminUser = isAdmin();
|
const isAdminUser = isAdmin();
|
||||||
const [isModalOpenurl, setIsModalOpenurl] = useState(false);
|
const [isModalOpenurl, setIsModalOpenurl] = useState(false);
|
||||||
|
const [showBanner, setShowBanner] = useState(false);
|
||||||
|
|
||||||
// 定义模态框图片URL的状态和更新函数
|
// 定义模态框图片URL的状态和更新函数
|
||||||
const [modalImageUrl, setModalImageUrl] = useState('');
|
const [modalImageUrl, setModalImageUrl] = useState('');
|
||||||
@ -380,11 +381,22 @@ const LogsTable = () => {
|
|||||||
refresh().then();
|
refresh().then();
|
||||||
}, [logType]);
|
}, [logType]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const mjNotifyEnabled = localStorage.getItem('mj_notify_enabled');
|
||||||
|
if (mjNotifyEnabled !== 'true') {
|
||||||
|
setShowBanner(true);
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|
||||||
<Layout>
|
<Layout>
|
||||||
|
{isAdminUser && showBanner ? <Banner
|
||||||
|
type="info"
|
||||||
|
description="当前未开启Midjourney回调,部分项目可能无法获得绘图结果,可在运营设置中开启。"
|
||||||
|
/> : <></>
|
||||||
|
}
|
||||||
<Form layout="horizontal" style={{ marginTop: 10 }}>
|
<Form layout="horizontal" style={{ marginTop: 10 }}>
|
||||||
<>
|
<>
|
||||||
<Form.Input field="channel_id" label="渠道 ID" style={{ width: 176 }} value={channel_id}
|
<Form.Input field="channel_id" label="渠道 ID" style={{ width: 176 }} value={channel_id}
|
||||||
|
@ -88,6 +88,8 @@ const OperationSetting = () => {
|
|||||||
if (name.endsWith('Enabled') || name === 'DataExportInterval' || name === 'DataExportDefaultTime' || name === 'DefaultCollapseSidebar') {
|
if (name.endsWith('Enabled') || name === 'DataExportInterval' || name === 'DataExportDefaultTime' || name === 'DefaultCollapseSidebar') {
|
||||||
if (name === 'DataExportDefaultTime') {
|
if (name === 'DataExportDefaultTime') {
|
||||||
localStorage.setItem('data_export_default_time', value);
|
localStorage.setItem('data_export_default_time', value);
|
||||||
|
} else if (name === 'MjNotifyEnabled') {
|
||||||
|
localStorage.setItem('mj_notify_enabled', value);
|
||||||
}
|
}
|
||||||
await updateOption(name, value);
|
await updateOption(name, value);
|
||||||
} else {
|
} else {
|
||||||
|
@ -130,6 +130,7 @@ const SiderBar = () => {
|
|||||||
localStorage.setItem('enable_data_export', data.enable_data_export);
|
localStorage.setItem('enable_data_export', data.enable_data_export);
|
||||||
localStorage.setItem('data_export_default_time', data.data_export_default_time);
|
localStorage.setItem('data_export_default_time', data.data_export_default_time);
|
||||||
localStorage.setItem('default_collapse_sidebar', data.default_collapse_sidebar);
|
localStorage.setItem('default_collapse_sidebar', data.default_collapse_sidebar);
|
||||||
|
localStorage.setItem('mj_notify_enabled', data.mj_notify_enabled);
|
||||||
if (data.chat_link) {
|
if (data.chat_link) {
|
||||||
localStorage.setItem('chat_link', data.chat_link);
|
localStorage.setItem('chat_link', data.chat_link);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user