mirror of
https://github.com/linux-do/new-api.git
synced 2025-09-17 16:06:38 +08:00
commit
8baeece386
@ -144,11 +144,13 @@ var (
|
|||||||
// All duration's unit is seconds
|
// All duration's unit is seconds
|
||||||
// Shouldn't larger then RateLimitKeyExpirationDuration
|
// Shouldn't larger then RateLimitKeyExpirationDuration
|
||||||
var (
|
var (
|
||||||
|
GlobalApiRateLimitEnable = GetEnvOrDefaultBool("GLOBAL_API_RATE_LIMIT_ENABLE", true)
|
||||||
GlobalApiRateLimitNum = GetEnvOrDefault("GLOBAL_API_RATE_LIMIT", 180)
|
GlobalApiRateLimitNum = GetEnvOrDefault("GLOBAL_API_RATE_LIMIT", 180)
|
||||||
GlobalApiRateLimitDuration int64 = 3 * 60
|
GlobalApiRateLimitDuration = int64(GetEnvOrDefault("GLOBAL_API_RATE_LIMIT_DURATION", 180))
|
||||||
|
|
||||||
|
GlobalWebRateLimitEnable = GetEnvOrDefaultBool("GLOBAL_WEB_RATE_LIMIT_ENABLE", true)
|
||||||
GlobalWebRateLimitNum = GetEnvOrDefault("GLOBAL_WEB_RATE_LIMIT", 60)
|
GlobalWebRateLimitNum = GetEnvOrDefault("GLOBAL_WEB_RATE_LIMIT", 60)
|
||||||
GlobalWebRateLimitDuration int64 = 3 * 60
|
GlobalWebRateLimitDuration = int64(GetEnvOrDefault("GLOBAL_WEB_RATE_LIMIT_DURATION", 180))
|
||||||
|
|
||||||
UploadRateLimitNum = 10
|
UploadRateLimitNum = 10
|
||||||
UploadRateLimitDuration int64 = 60
|
UploadRateLimitDuration int64 = 60
|
||||||
|
@ -13,6 +13,10 @@ var timeFormat = "2006-01-02T15:04:05.000Z"
|
|||||||
|
|
||||||
var inMemoryRateLimiter common.InMemoryRateLimiter
|
var inMemoryRateLimiter common.InMemoryRateLimiter
|
||||||
|
|
||||||
|
var defNext = func(c *gin.Context) {
|
||||||
|
c.Next()
|
||||||
|
}
|
||||||
|
|
||||||
func redisRateLimiter(c *gin.Context, maxRequestNum int, duration int64, mark string) {
|
func redisRateLimiter(c *gin.Context, maxRequestNum int, duration int64, mark string) {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
rdb := common.RDB
|
rdb := common.RDB
|
||||||
@ -83,11 +87,17 @@ func rateLimitFactory(maxRequestNum int, duration int64, mark string) func(c *gi
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GlobalWebRateLimit() func(c *gin.Context) {
|
func GlobalWebRateLimit() func(c *gin.Context) {
|
||||||
|
if common.GlobalWebRateLimitEnable {
|
||||||
return rateLimitFactory(common.GlobalWebRateLimitNum, common.GlobalWebRateLimitDuration, "GW")
|
return rateLimitFactory(common.GlobalWebRateLimitNum, common.GlobalWebRateLimitDuration, "GW")
|
||||||
|
}
|
||||||
|
return defNext
|
||||||
}
|
}
|
||||||
|
|
||||||
func GlobalAPIRateLimit() func(c *gin.Context) {
|
func GlobalAPIRateLimit() func(c *gin.Context) {
|
||||||
|
if common.GlobalApiRateLimitEnable {
|
||||||
return rateLimitFactory(common.GlobalApiRateLimitNum, common.GlobalApiRateLimitDuration, "GA")
|
return rateLimitFactory(common.GlobalApiRateLimitNum, common.GlobalApiRateLimitDuration, "GA")
|
||||||
|
}
|
||||||
|
return defNext
|
||||||
}
|
}
|
||||||
|
|
||||||
func CriticalRateLimit() func(c *gin.Context) {
|
func CriticalRateLimit() func(c *gin.Context) {
|
||||||
|
@ -17,7 +17,7 @@ import {
|
|||||||
renderQuota,
|
renderQuota,
|
||||||
} from '../helpers/render';
|
} from '../helpers/render';
|
||||||
import {
|
import {
|
||||||
Button,
|
Button, Divider,
|
||||||
Dropdown,
|
Dropdown,
|
||||||
Form,
|
Form,
|
||||||
InputNumber,
|
InputNumber,
|
||||||
@ -720,7 +720,7 @@ const ChannelsTable = () => {
|
|||||||
}}
|
}}
|
||||||
labelPosition='left'
|
labelPosition='left'
|
||||||
>
|
>
|
||||||
<div style={{ display: 'flex' }}>
|
<div style={{display: 'flex'}}>
|
||||||
<Space>
|
<Space>
|
||||||
<Form.Input
|
<Form.Input
|
||||||
field='search_keyword'
|
field='search_keyword'
|
||||||
@ -745,7 +745,7 @@ const ChannelsTable = () => {
|
|||||||
<Form.Select
|
<Form.Select
|
||||||
field='group'
|
field='group'
|
||||||
label='分组'
|
label='分组'
|
||||||
optionList={[{ label: '选择分组', value: null}, ...groupOptions]}
|
optionList={[{label: '选择分组', value: null}, ...groupOptions]}
|
||||||
initValue={null}
|
initValue={null}
|
||||||
onChange={(v) => {
|
onChange={(v) => {
|
||||||
setSearchGroup(v);
|
setSearchGroup(v);
|
||||||
@ -757,16 +757,25 @@ const ChannelsTable = () => {
|
|||||||
type='primary'
|
type='primary'
|
||||||
htmlType='submit'
|
htmlType='submit'
|
||||||
className='btn-margin-right'
|
className='btn-margin-right'
|
||||||
style={{ marginRight: 8 }}
|
style={{marginRight: 8}}
|
||||||
>
|
>
|
||||||
查询
|
查询
|
||||||
</Button>
|
</Button>
|
||||||
</Space>
|
</Space>
|
||||||
</div>
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
<div style={{ marginTop: 10, display: 'flex' }}>
|
<Divider style={{marginBottom:15}}/>
|
||||||
<Space>
|
<div
|
||||||
<Space>
|
style={{
|
||||||
|
display: isMobile() ? '' : 'flex',
|
||||||
|
marginTop: isMobile() ? 0 : -45,
|
||||||
|
zIndex: 999,
|
||||||
|
pointerEvents: 'none',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Space
|
||||||
|
style={{pointerEvents: 'auto', marginTop: isMobile() ? 0 : 45}}
|
||||||
|
>
|
||||||
<Typography.Text strong>使用ID排序</Typography.Text>
|
<Typography.Text strong>使用ID排序</Typography.Text>
|
||||||
<Switch
|
<Switch
|
||||||
checked={idSort}
|
checked={idSort}
|
||||||
@ -783,13 +792,104 @@ const ChannelsTable = () => {
|
|||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
></Switch>
|
></Switch>
|
||||||
|
<Button
|
||||||
|
theme='light'
|
||||||
|
type='primary'
|
||||||
|
style={{marginRight: 8}}
|
||||||
|
onClick={() => {
|
||||||
|
setEditingChannel({
|
||||||
|
id: undefined,
|
||||||
|
});
|
||||||
|
setShowEdit(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
添加渠道
|
||||||
|
</Button>
|
||||||
|
<Popconfirm
|
||||||
|
title='确定?'
|
||||||
|
okType={'warning'}
|
||||||
|
onConfirm={testAllChannels}
|
||||||
|
position={isMobile() ? 'top' : 'top'}
|
||||||
|
>
|
||||||
|
<Button theme='light' type='warning' style={{marginRight: 8}}>
|
||||||
|
测试所有通道
|
||||||
|
</Button>
|
||||||
|
</Popconfirm>
|
||||||
|
<Popconfirm
|
||||||
|
title='确定?'
|
||||||
|
okType={'secondary'}
|
||||||
|
onConfirm={updateAllChannelsBalance}
|
||||||
|
>
|
||||||
|
<Button theme='light' type='secondary' style={{marginRight: 8}}>
|
||||||
|
更新所有已启用通道余额
|
||||||
|
</Button>
|
||||||
|
</Popconfirm>
|
||||||
|
<Popconfirm
|
||||||
|
title='确定是否要删除禁用通道?'
|
||||||
|
content='此修改将不可逆'
|
||||||
|
okType={'danger'}
|
||||||
|
onConfirm={deleteAllDisabledChannels}
|
||||||
|
>
|
||||||
|
<Button theme='light' type='danger' style={{marginRight: 8}}>
|
||||||
|
删除禁用通道
|
||||||
|
</Button>
|
||||||
|
</Popconfirm>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
theme='light'
|
||||||
|
type='primary'
|
||||||
|
style={{marginRight: 8}}
|
||||||
|
onClick={refresh}
|
||||||
|
>
|
||||||
|
刷新
|
||||||
|
</Button>
|
||||||
</Space>
|
</Space>
|
||||||
|
</div>
|
||||||
|
<div style={{marginTop: 20}}>
|
||||||
|
<Space>
|
||||||
|
<Typography.Text strong>开启批量删除</Typography.Text>
|
||||||
|
<Switch
|
||||||
|
label='开启批量删除'
|
||||||
|
uncheckedText='关'
|
||||||
|
aria-label='是否开启批量删除'
|
||||||
|
onChange={(v) => {
|
||||||
|
setEnableBatchDelete(v);
|
||||||
|
}}
|
||||||
|
></Switch>
|
||||||
|
<Popconfirm
|
||||||
|
title='确定是否要删除所选通道?'
|
||||||
|
content='此修改将不可逆'
|
||||||
|
okType={'danger'}
|
||||||
|
onConfirm={batchDeleteChannels}
|
||||||
|
disabled={!enableBatchDelete}
|
||||||
|
position={'top'}
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
disabled={!enableBatchDelete}
|
||||||
|
theme='light'
|
||||||
|
type='danger'
|
||||||
|
style={{marginRight: 8}}
|
||||||
|
>
|
||||||
|
删除所选通道
|
||||||
|
</Button>
|
||||||
|
</Popconfirm>
|
||||||
|
<Popconfirm
|
||||||
|
title='确定是否要修复数据库一致性?'
|
||||||
|
content='进行该操作时,可能导致渠道访问错误,请仅在数据库出现问题时使用'
|
||||||
|
okType={'warning'}
|
||||||
|
onConfirm={fixChannelsAbilities}
|
||||||
|
position={'top'}
|
||||||
|
>
|
||||||
|
<Button theme='light' type='secondary' style={{marginRight: 8}}>
|
||||||
|
修复数据库一致性
|
||||||
|
</Button>
|
||||||
|
</Popconfirm>
|
||||||
</Space>
|
</Space>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Table
|
<Table
|
||||||
className={'channel-table'}
|
className={'channel-table'}
|
||||||
style={{ marginTop: 15 }}
|
style={{marginTop: 15}}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
dataSource={pageData}
|
dataSource={pageData}
|
||||||
pagination={{
|
pagination={{
|
||||||
@ -817,115 +917,6 @@ const ChannelsTable = () => {
|
|||||||
: null
|
: null
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
display: isMobile() ? '' : 'flex',
|
|
||||||
marginTop: isMobile() ? 0 : -45,
|
|
||||||
zIndex: 999,
|
|
||||||
position: 'relative',
|
|
||||||
pointerEvents: 'none',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Space
|
|
||||||
style={{ pointerEvents: 'auto', marginTop: isMobile() ? 0 : 45 }}
|
|
||||||
>
|
|
||||||
<Button
|
|
||||||
theme='light'
|
|
||||||
type='primary'
|
|
||||||
style={{ marginRight: 8 }}
|
|
||||||
onClick={() => {
|
|
||||||
setEditingChannel({
|
|
||||||
id: undefined,
|
|
||||||
});
|
|
||||||
setShowEdit(true);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
添加渠道
|
|
||||||
</Button>
|
|
||||||
<Popconfirm
|
|
||||||
title='确定?'
|
|
||||||
okType={'warning'}
|
|
||||||
onConfirm={testAllChannels}
|
|
||||||
position={isMobile() ? 'top' : 'top'}
|
|
||||||
>
|
|
||||||
<Button theme='light' type='warning' style={{ marginRight: 8 }}>
|
|
||||||
测试所有通道
|
|
||||||
</Button>
|
|
||||||
</Popconfirm>
|
|
||||||
<Popconfirm
|
|
||||||
title='确定?'
|
|
||||||
okType={'secondary'}
|
|
||||||
onConfirm={updateAllChannelsBalance}
|
|
||||||
>
|
|
||||||
<Button theme='light' type='secondary' style={{ marginRight: 8 }}>
|
|
||||||
更新所有已启用通道余额
|
|
||||||
</Button>
|
|
||||||
</Popconfirm>
|
|
||||||
<Popconfirm
|
|
||||||
title='确定是否要删除禁用通道?'
|
|
||||||
content='此修改将不可逆'
|
|
||||||
okType={'danger'}
|
|
||||||
onConfirm={deleteAllDisabledChannels}
|
|
||||||
>
|
|
||||||
<Button theme='light' type='danger' style={{ marginRight: 8 }}>
|
|
||||||
删除禁用通道
|
|
||||||
</Button>
|
|
||||||
</Popconfirm>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
theme='light'
|
|
||||||
type='primary'
|
|
||||||
style={{ marginRight: 8 }}
|
|
||||||
onClick={refresh}
|
|
||||||
>
|
|
||||||
刷新
|
|
||||||
</Button>
|
|
||||||
</Space>
|
|
||||||
{/*<div style={{width: '100%', pointerEvents: 'none', position: 'absolute'}}>*/}
|
|
||||||
|
|
||||||
{/*</div>*/}
|
|
||||||
</div>
|
|
||||||
<div style={{ marginTop: 20 }}>
|
|
||||||
<Space>
|
|
||||||
<Typography.Text strong>开启批量删除</Typography.Text>
|
|
||||||
<Switch
|
|
||||||
label='开启批量删除'
|
|
||||||
uncheckedText='关'
|
|
||||||
aria-label='是否开启批量删除'
|
|
||||||
onChange={(v) => {
|
|
||||||
setEnableBatchDelete(v);
|
|
||||||
}}
|
|
||||||
></Switch>
|
|
||||||
<Popconfirm
|
|
||||||
title='确定是否要删除所选通道?'
|
|
||||||
content='此修改将不可逆'
|
|
||||||
okType={'danger'}
|
|
||||||
onConfirm={batchDeleteChannels}
|
|
||||||
disabled={!enableBatchDelete}
|
|
||||||
position={'top'}
|
|
||||||
>
|
|
||||||
<Button
|
|
||||||
disabled={!enableBatchDelete}
|
|
||||||
theme='light'
|
|
||||||
type='danger'
|
|
||||||
style={{ marginRight: 8 }}
|
|
||||||
>
|
|
||||||
删除所选通道
|
|
||||||
</Button>
|
|
||||||
</Popconfirm>
|
|
||||||
<Popconfirm
|
|
||||||
title='确定是否要修复数据库一致性?'
|
|
||||||
content='进行该操作时,可能导致渠道访问错误,请仅在数据库出现问题时使用'
|
|
||||||
okType={'warning'}
|
|
||||||
onConfirm={fixChannelsAbilities}
|
|
||||||
position={'top'}
|
|
||||||
>
|
|
||||||
<Button theme='light' type='secondary' style={{ marginRight: 8 }}>
|
|
||||||
修复数据库一致性
|
|
||||||
</Button>
|
|
||||||
</Popconfirm>
|
|
||||||
</Space>
|
|
||||||
</div>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -767,6 +767,22 @@ const LogsTable = () => {
|
|||||||
<Form.Section></Form.Section>
|
<Form.Section></Form.Section>
|
||||||
</>
|
</>
|
||||||
</Form>
|
</Form>
|
||||||
|
<div style={{marginTop:10}}>
|
||||||
|
<Select
|
||||||
|
defaultValue='0'
|
||||||
|
style={{ width: 120 }}
|
||||||
|
onChange={(value) => {
|
||||||
|
setLogType(parseInt(value));
|
||||||
|
loadLogs(0, pageSize, parseInt(value));
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Select.Option value='0'>全部</Select.Option>
|
||||||
|
<Select.Option value='1'>充值</Select.Option>
|
||||||
|
<Select.Option value='2'>消费</Select.Option>
|
||||||
|
<Select.Option value='3'>管理</Select.Option>
|
||||||
|
<Select.Option value='4'>系统</Select.Option>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
<Table
|
<Table
|
||||||
style={{ marginTop: 5 }}
|
style={{ marginTop: 5 }}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
@ -786,20 +802,6 @@ const LogsTable = () => {
|
|||||||
onPageChange: handlePageChange,
|
onPageChange: handlePageChange,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Select
|
|
||||||
defaultValue='0'
|
|
||||||
style={{ width: 120 }}
|
|
||||||
onChange={(value) => {
|
|
||||||
setLogType(parseInt(value));
|
|
||||||
loadLogs(0, pageSize, parseInt(value));
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Select.Option value='0'>全部</Select.Option>
|
|
||||||
<Select.Option value='1'>充值</Select.Option>
|
|
||||||
<Select.Option value='2'>消费</Select.Option>
|
|
||||||
<Select.Option value='3'>管理</Select.Option>
|
|
||||||
<Select.Option value='4'>系统</Select.Option>
|
|
||||||
</Select>
|
|
||||||
</Layout>
|
</Layout>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
@ -10,7 +10,7 @@ import {
|
|||||||
import { ITEMS_PER_PAGE } from '../constants';
|
import { ITEMS_PER_PAGE } from '../constants';
|
||||||
import { renderQuota } from '../helpers/render';
|
import { renderQuota } from '../helpers/render';
|
||||||
import {
|
import {
|
||||||
Button,
|
Button, Divider,
|
||||||
Form,
|
Form,
|
||||||
Modal,
|
Modal,
|
||||||
Popconfirm,
|
Popconfirm,
|
||||||
@ -391,29 +391,8 @@ const RedemptionsTable = () => {
|
|||||||
onChange={handleKeywordChange}
|
onChange={handleKeywordChange}
|
||||||
/>
|
/>
|
||||||
</Form>
|
</Form>
|
||||||
|
<Divider style={{margin:'5px 0 15px 0'}}/>
|
||||||
<Table
|
<div>
|
||||||
style={{ marginTop: 20 }}
|
|
||||||
columns={columns}
|
|
||||||
dataSource={pageData}
|
|
||||||
pagination={{
|
|
||||||
currentPage: activePage,
|
|
||||||
pageSize: ITEMS_PER_PAGE,
|
|
||||||
total: tokenCount,
|
|
||||||
// showSizeChanger: true,
|
|
||||||
// pageSizeOptions: [10, 20, 50, 100],
|
|
||||||
formatPageText: (page) =>
|
|
||||||
`第 ${page.currentStart} - ${page.currentEnd} 条,共 ${redemptions.length} 条`,
|
|
||||||
// onPageSizeChange: (size) => {
|
|
||||||
// setPageSize(size);
|
|
||||||
// setActivePage(1);
|
|
||||||
// },
|
|
||||||
onPageChange: handlePageChange,
|
|
||||||
}}
|
|
||||||
loading={loading}
|
|
||||||
rowSelection={rowSelection}
|
|
||||||
onRow={handleRow}
|
|
||||||
></Table>
|
|
||||||
<Button
|
<Button
|
||||||
theme='light'
|
theme='light'
|
||||||
type='primary'
|
type='primary'
|
||||||
@ -444,6 +423,30 @@ const RedemptionsTable = () => {
|
|||||||
>
|
>
|
||||||
复制所选兑换码到剪贴板
|
复制所选兑换码到剪贴板
|
||||||
</Button>
|
</Button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Table
|
||||||
|
style={{ marginTop: 20 }}
|
||||||
|
columns={columns}
|
||||||
|
dataSource={pageData}
|
||||||
|
pagination={{
|
||||||
|
currentPage: activePage,
|
||||||
|
pageSize: ITEMS_PER_PAGE,
|
||||||
|
total: tokenCount,
|
||||||
|
// showSizeChanger: true,
|
||||||
|
// pageSizeOptions: [10, 20, 50, 100],
|
||||||
|
formatPageText: (page) =>
|
||||||
|
`第 ${page.currentStart} - ${page.currentEnd} 条,共 ${redemptions.length} 条`,
|
||||||
|
// onPageSizeChange: (size) => {
|
||||||
|
// setPageSize(size);
|
||||||
|
// setActivePage(1);
|
||||||
|
// },
|
||||||
|
onPageChange: handlePageChange,
|
||||||
|
}}
|
||||||
|
loading={loading}
|
||||||
|
rowSelection={rowSelection}
|
||||||
|
onRow={handleRow}
|
||||||
|
></Table>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -10,7 +10,7 @@ import {
|
|||||||
import { ITEMS_PER_PAGE } from '../constants';
|
import { ITEMS_PER_PAGE } from '../constants';
|
||||||
import {renderGroup, renderQuota} from '../helpers/render';
|
import {renderGroup, renderQuota} from '../helpers/render';
|
||||||
import {
|
import {
|
||||||
Button,
|
Button, Divider,
|
||||||
Dropdown,
|
Dropdown,
|
||||||
Form,
|
Form,
|
||||||
Modal,
|
Modal,
|
||||||
@ -596,29 +596,8 @@ const TokensTable = () => {
|
|||||||
查询
|
查询
|
||||||
</Button>
|
</Button>
|
||||||
</Form>
|
</Form>
|
||||||
|
<Divider style={{margin:'15px 0'}}/>
|
||||||
<Table
|
<div>
|
||||||
style={{ marginTop: 20 }}
|
|
||||||
columns={columns}
|
|
||||||
dataSource={pageData}
|
|
||||||
pagination={{
|
|
||||||
currentPage: activePage,
|
|
||||||
pageSize: pageSize,
|
|
||||||
total: tokenCount,
|
|
||||||
showSizeChanger: true,
|
|
||||||
pageSizeOptions: [10, 20, 50, 100],
|
|
||||||
formatPageText: (page) =>
|
|
||||||
`第 ${page.currentStart} - ${page.currentEnd} 条,共 ${tokens.length} 条`,
|
|
||||||
onPageSizeChange: (size) => {
|
|
||||||
setPageSize(size);
|
|
||||||
setActivePage(1);
|
|
||||||
},
|
|
||||||
onPageChange: handlePageChange,
|
|
||||||
}}
|
|
||||||
loading={loading}
|
|
||||||
rowSelection={rowSelection}
|
|
||||||
onRow={handleRow}
|
|
||||||
></Table>
|
|
||||||
<Button
|
<Button
|
||||||
theme='light'
|
theme='light'
|
||||||
type='primary'
|
type='primary'
|
||||||
@ -650,6 +629,30 @@ const TokensTable = () => {
|
|||||||
>
|
>
|
||||||
复制所选令牌到剪贴板
|
复制所选令牌到剪贴板
|
||||||
</Button>
|
</Button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Table
|
||||||
|
style={{ marginTop: 20 }}
|
||||||
|
columns={columns}
|
||||||
|
dataSource={pageData}
|
||||||
|
pagination={{
|
||||||
|
currentPage: activePage,
|
||||||
|
pageSize: pageSize,
|
||||||
|
total: tokenCount,
|
||||||
|
showSizeChanger: true,
|
||||||
|
pageSizeOptions: [10, 20, 50, 100],
|
||||||
|
formatPageText: (page) =>
|
||||||
|
`第 ${page.currentStart} - ${page.currentEnd} 条,共 ${tokens.length} 条`,
|
||||||
|
onPageSizeChange: (size) => {
|
||||||
|
setPageSize(size);
|
||||||
|
setActivePage(1);
|
||||||
|
},
|
||||||
|
onPageChange: handlePageChange,
|
||||||
|
}}
|
||||||
|
loading={loading}
|
||||||
|
rowSelection={rowSelection}
|
||||||
|
onRow={handleRow}
|
||||||
|
></Table>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -476,10 +476,18 @@ const UsersTable = () => {
|
|||||||
type='primary'
|
type='primary'
|
||||||
htmlType='submit'
|
htmlType='submit'
|
||||||
className='btn-margin-right'
|
className='btn-margin-right'
|
||||||
style={{ marginRight: 8 }}
|
|
||||||
>
|
>
|
||||||
查询
|
查询
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button
|
||||||
|
theme='light'
|
||||||
|
type='primary'
|
||||||
|
onClick={() => {
|
||||||
|
setShowAddUser(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
添加用户
|
||||||
|
</Button>
|
||||||
</Space>
|
</Space>
|
||||||
</div>
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
@ -496,16 +504,6 @@ const UsersTable = () => {
|
|||||||
}}
|
}}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
/>
|
/>
|
||||||
<Button
|
|
||||||
theme='light'
|
|
||||||
type='primary'
|
|
||||||
style={{ marginRight: 8 }}
|
|
||||||
onClick={() => {
|
|
||||||
setShowAddUser(true);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
添加用户
|
|
||||||
</Button>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -144,7 +144,7 @@ export default function SettingsCreditLimit(props) {
|
|||||||
</Row>
|
</Row>
|
||||||
|
|
||||||
<Row>
|
<Row>
|
||||||
<Button size='large' onClick={onSubmit}>
|
<Button size='default' onClick={onSubmit}>
|
||||||
保存额度设置
|
保存额度设置
|
||||||
</Button>
|
</Button>
|
||||||
</Row>
|
</Row>
|
||||||
|
@ -87,7 +87,7 @@ export default function DataDashboard(props) {
|
|||||||
<Form.Switch
|
<Form.Switch
|
||||||
field={'DataExportEnabled'}
|
field={'DataExportEnabled'}
|
||||||
label={'启用数据看板(实验性)'}
|
label={'启用数据看板(实验性)'}
|
||||||
size='large'
|
size='default'
|
||||||
checkedText='|'
|
checkedText='|'
|
||||||
uncheckedText='〇'
|
uncheckedText='〇'
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
@ -135,7 +135,7 @@ export default function DataDashboard(props) {
|
|||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
<Row>
|
<Row>
|
||||||
<Button size='large' onClick={onSubmit}>
|
<Button size='default' onClick={onSubmit}>
|
||||||
保存数据看板设置
|
保存数据看板设置
|
||||||
</Button>
|
</Button>
|
||||||
</Row>
|
</Row>
|
||||||
|
@ -81,7 +81,7 @@ export default function SettingsDrawing(props) {
|
|||||||
<Form.Switch
|
<Form.Switch
|
||||||
field={'DrawingEnabled'}
|
field={'DrawingEnabled'}
|
||||||
label={'启用绘图功能'}
|
label={'启用绘图功能'}
|
||||||
size='large'
|
size='default'
|
||||||
checkedText='|'
|
checkedText='|'
|
||||||
uncheckedText='〇'
|
uncheckedText='〇'
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
@ -96,7 +96,7 @@ export default function SettingsDrawing(props) {
|
|||||||
<Form.Switch
|
<Form.Switch
|
||||||
field={'MjNotifyEnabled'}
|
field={'MjNotifyEnabled'}
|
||||||
label={'允许回调(会泄露服务器 IP 地址)'}
|
label={'允许回调(会泄露服务器 IP 地址)'}
|
||||||
size='large'
|
size='default'
|
||||||
checkedText='|'
|
checkedText='|'
|
||||||
uncheckedText='〇'
|
uncheckedText='〇'
|
||||||
onChange={(value) =>
|
onChange={(value) =>
|
||||||
@ -111,7 +111,7 @@ export default function SettingsDrawing(props) {
|
|||||||
<Form.Switch
|
<Form.Switch
|
||||||
field={'MjAccountFilterEnabled'}
|
field={'MjAccountFilterEnabled'}
|
||||||
label={'允许 AccountFilter 参数'}
|
label={'允许 AccountFilter 参数'}
|
||||||
size='large'
|
size='default'
|
||||||
checkedText='|'
|
checkedText='|'
|
||||||
uncheckedText='〇'
|
uncheckedText='〇'
|
||||||
onChange={(value) =>
|
onChange={(value) =>
|
||||||
@ -126,7 +126,7 @@ export default function SettingsDrawing(props) {
|
|||||||
<Form.Switch
|
<Form.Switch
|
||||||
field={'MjForwardUrlEnabled'}
|
field={'MjForwardUrlEnabled'}
|
||||||
label={'开启之后将上游地址替换为服务器地址'}
|
label={'开启之后将上游地址替换为服务器地址'}
|
||||||
size='large'
|
size='default'
|
||||||
checkedText='|'
|
checkedText='|'
|
||||||
uncheckedText='〇'
|
uncheckedText='〇'
|
||||||
onChange={(value) =>
|
onChange={(value) =>
|
||||||
@ -146,7 +146,7 @@ export default function SettingsDrawing(props) {
|
|||||||
<Tag>--relax</Tag> 以及 <Tag>--turbo</Tag> 参数
|
<Tag>--relax</Tag> 以及 <Tag>--turbo</Tag> 参数
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
size='large'
|
size='default'
|
||||||
checkedText='|'
|
checkedText='|'
|
||||||
uncheckedText='〇'
|
uncheckedText='〇'
|
||||||
onChange={(value) =>
|
onChange={(value) =>
|
||||||
@ -165,7 +165,7 @@ export default function SettingsDrawing(props) {
|
|||||||
检测必须等待绘图成功才能进行放大等操作
|
检测必须等待绘图成功才能进行放大等操作
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
size='large'
|
size='default'
|
||||||
checkedText='|'
|
checkedText='|'
|
||||||
uncheckedText='〇'
|
uncheckedText='〇'
|
||||||
onChange={(value) =>
|
onChange={(value) =>
|
||||||
@ -178,7 +178,7 @@ export default function SettingsDrawing(props) {
|
|||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
<Row>
|
<Row>
|
||||||
<Button size='large' onClick={onSubmit}>
|
<Button size='default' onClick={onSubmit}>
|
||||||
保存绘图设置
|
保存绘图设置
|
||||||
</Button>
|
</Button>
|
||||||
</Row>
|
</Row>
|
||||||
|
@ -141,7 +141,7 @@ export default function GeneralSettings(props) {
|
|||||||
<Form.Switch
|
<Form.Switch
|
||||||
field={'DisplayInCurrencyEnabled'}
|
field={'DisplayInCurrencyEnabled'}
|
||||||
label={'以货币形式显示额度'}
|
label={'以货币形式显示额度'}
|
||||||
size='large'
|
size='default'
|
||||||
checkedText='|'
|
checkedText='|'
|
||||||
uncheckedText='〇'
|
uncheckedText='〇'
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
@ -156,7 +156,7 @@ export default function GeneralSettings(props) {
|
|||||||
<Form.Switch
|
<Form.Switch
|
||||||
field={'DisplayTokenStatEnabled'}
|
field={'DisplayTokenStatEnabled'}
|
||||||
label={'Billing 相关 API 显示令牌额度而非用户额度'}
|
label={'Billing 相关 API 显示令牌额度而非用户额度'}
|
||||||
size='large'
|
size='default'
|
||||||
checkedText='|'
|
checkedText='|'
|
||||||
uncheckedText='〇'
|
uncheckedText='〇'
|
||||||
onChange={(value) =>
|
onChange={(value) =>
|
||||||
@ -171,7 +171,7 @@ export default function GeneralSettings(props) {
|
|||||||
<Form.Switch
|
<Form.Switch
|
||||||
field={'DefaultCollapseSidebar'}
|
field={'DefaultCollapseSidebar'}
|
||||||
label={'默认折叠侧边栏'}
|
label={'默认折叠侧边栏'}
|
||||||
size='large'
|
size='default'
|
||||||
checkedText='|'
|
checkedText='|'
|
||||||
uncheckedText='〇'
|
uncheckedText='〇'
|
||||||
onChange={(value) =>
|
onChange={(value) =>
|
||||||
@ -184,7 +184,7 @@ export default function GeneralSettings(props) {
|
|||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
<Row>
|
<Row>
|
||||||
<Button size='large' onClick={onSubmit}>
|
<Button size='default' onClick={onSubmit}>
|
||||||
保存通用设置
|
保存通用设置
|
||||||
</Button>
|
</Button>
|
||||||
</Row>
|
</Row>
|
||||||
|
@ -102,7 +102,7 @@ export default function SettingsLog(props) {
|
|||||||
<Form.Switch
|
<Form.Switch
|
||||||
field={'LogConsumeEnabled'}
|
field={'LogConsumeEnabled'}
|
||||||
label={'启用额度消费日志记录'}
|
label={'启用额度消费日志记录'}
|
||||||
size='large'
|
size='default'
|
||||||
checkedText='|'
|
checkedText='|'
|
||||||
uncheckedText='〇'
|
uncheckedText='〇'
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
@ -135,7 +135,7 @@ export default function SettingsLog(props) {
|
|||||||
</Row>
|
</Row>
|
||||||
|
|
||||||
<Row>
|
<Row>
|
||||||
<Button size='large' onClick={onSubmit}>
|
<Button size='default' onClick={onSubmit}>
|
||||||
保存日志设置
|
保存日志设置
|
||||||
</Button>
|
</Button>
|
||||||
</Row>
|
</Row>
|
||||||
|
@ -114,7 +114,7 @@ export default function SettingsMonitoring(props) {
|
|||||||
<Form.Switch
|
<Form.Switch
|
||||||
field={'AutomaticDisableChannelEnabled'}
|
field={'AutomaticDisableChannelEnabled'}
|
||||||
label={'失败时自动禁用通道'}
|
label={'失败时自动禁用通道'}
|
||||||
size='large'
|
size='default'
|
||||||
checkedText='|'
|
checkedText='|'
|
||||||
uncheckedText='〇'
|
uncheckedText='〇'
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
@ -129,7 +129,7 @@ export default function SettingsMonitoring(props) {
|
|||||||
<Form.Switch
|
<Form.Switch
|
||||||
field={'AutomaticEnableChannelEnabled'}
|
field={'AutomaticEnableChannelEnabled'}
|
||||||
label={'成功时自动启用通道'}
|
label={'成功时自动启用通道'}
|
||||||
size='large'
|
size='default'
|
||||||
checkedText='|'
|
checkedText='|'
|
||||||
uncheckedText='〇'
|
uncheckedText='〇'
|
||||||
onChange={(value) =>
|
onChange={(value) =>
|
||||||
@ -142,7 +142,7 @@ export default function SettingsMonitoring(props) {
|
|||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
<Row>
|
<Row>
|
||||||
<Button size='large' onClick={onSubmit}>
|
<Button size='default' onClick={onSubmit}>
|
||||||
保存监控设置
|
保存监控设置
|
||||||
</Button>
|
</Button>
|
||||||
</Row>
|
</Row>
|
||||||
|
@ -77,7 +77,7 @@ export default function SettingsSensitiveWords(props) {
|
|||||||
<Form.Switch
|
<Form.Switch
|
||||||
field={'CheckSensitiveEnabled'}
|
field={'CheckSensitiveEnabled'}
|
||||||
label={'启用屏蔽词过滤功能'}
|
label={'启用屏蔽词过滤功能'}
|
||||||
size='large'
|
size='default'
|
||||||
checkedText='|'
|
checkedText='|'
|
||||||
uncheckedText='〇'
|
uncheckedText='〇'
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
@ -92,7 +92,7 @@ export default function SettingsSensitiveWords(props) {
|
|||||||
<Form.Switch
|
<Form.Switch
|
||||||
field={'CheckSensitiveOnPromptEnabled'}
|
field={'CheckSensitiveOnPromptEnabled'}
|
||||||
label={'启用 Prompt 检查'}
|
label={'启用 Prompt 检查'}
|
||||||
size='large'
|
size='default'
|
||||||
checkedText='|'
|
checkedText='|'
|
||||||
uncheckedText='〇'
|
uncheckedText='〇'
|
||||||
onChange={(value) =>
|
onChange={(value) =>
|
||||||
@ -123,7 +123,7 @@ export default function SettingsSensitiveWords(props) {
|
|||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
<Row>
|
<Row>
|
||||||
<Button size='large' onClick={onSubmit}>
|
<Button size='default' onClick={onSubmit}>
|
||||||
保存屏蔽词过滤设置
|
保存屏蔽词过滤设置
|
||||||
</Button>
|
</Button>
|
||||||
</Row>
|
</Row>
|
||||||
|
Loading…
Reference in New Issue
Block a user