feat(douyu): 整合自动化中心并修复重登队列
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
Button,
|
||||
Card,
|
||||
Col,
|
||||
Collapse,
|
||||
Empty,
|
||||
Form,
|
||||
Input,
|
||||
@@ -80,6 +81,76 @@ interface TrendRow {
|
||||
reloginOk: number;
|
||||
}
|
||||
|
||||
function MiniTrend({
|
||||
title,
|
||||
values,
|
||||
dates,
|
||||
color,
|
||||
suffix = '',
|
||||
}: {
|
||||
title: string;
|
||||
values: number[];
|
||||
dates: string[];
|
||||
color: string;
|
||||
suffix?: string;
|
||||
}) {
|
||||
const width = 260;
|
||||
const height = 64;
|
||||
const padding = 5;
|
||||
const max = Math.max(...values, 1);
|
||||
const step = values.length > 1 ? (width - padding * 2) / (values.length - 1) : 0;
|
||||
const points = values.map((value, index) => {
|
||||
const x = padding + step * index;
|
||||
const y = height - padding - (Math.max(0, value) / max) * (height - padding * 2);
|
||||
return `${x},${y}`;
|
||||
}).join(' ');
|
||||
const latest = values.at(-1) || 0;
|
||||
|
||||
return (
|
||||
<div style={{ minWidth: 0 }}>
|
||||
<Space size={8} align="baseline">
|
||||
<Text strong>{title}</Text>
|
||||
<Text type="secondary" style={{ fontSize: 12 }}>
|
||||
最近 {latest}{suffix}
|
||||
</Text>
|
||||
</Space>
|
||||
<svg
|
||||
viewBox={`0 0 ${width} ${height}`}
|
||||
width="100%"
|
||||
height={74}
|
||||
role="img"
|
||||
aria-label={`${title}趋势`}
|
||||
preserveAspectRatio="none"
|
||||
style={{ display: 'block', marginTop: 6 }}
|
||||
>
|
||||
<line
|
||||
x1={padding}
|
||||
y1={height - padding}
|
||||
x2={width - padding}
|
||||
y2={height - padding}
|
||||
stroke="currentColor"
|
||||
opacity={0.12}
|
||||
/>
|
||||
{points ? (
|
||||
<polyline
|
||||
points={points}
|
||||
fill="none"
|
||||
stroke={color}
|
||||
strokeWidth={2.5}
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
vectorEffect="non-scaling-stroke"
|
||||
/>
|
||||
) : null}
|
||||
</svg>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||
<Text type="secondary" style={{ fontSize: 11 }}>{dates[0]?.slice(5) || '-'}</Text>
|
||||
<Text type="secondary" style={{ fontSize: 11 }}>{dates.at(-1)?.slice(5) || '-'}</Text>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default function AccountPlatformStatusPanel() {
|
||||
const { can } = usePermissions();
|
||||
const canManage = can('douyu:config');
|
||||
@@ -606,16 +677,66 @@ export default function AccountPlatformStatusPanel() {
|
||||
}}
|
||||
/>
|
||||
|
||||
<Space orientation="vertical" size={8} style={{ width: '100%', marginTop: 20 }}>
|
||||
<Text strong>{`近 ${trends?.days || 7} 天趋势`}</Text>
|
||||
<Table
|
||||
rowKey="date"
|
||||
size="small"
|
||||
columns={trendColumns}
|
||||
dataSource={trendRows}
|
||||
loading={trendsLoading}
|
||||
pagination={false}
|
||||
scroll={{ x: 750 }}
|
||||
<Space orientation="vertical" size={12} style={{ width: '100%', marginTop: 20 }}>
|
||||
<div>
|
||||
<Text strong>{`近 ${trends?.days || 7} 天运行趋势`}</Text>
|
||||
<Text type="secondary" style={{ marginLeft: 8 }}>
|
||||
查询、登录、CK 失效和重登结果
|
||||
</Text>
|
||||
</div>
|
||||
<Row gutter={[24, 16]}>
|
||||
<Col xs={24} md={12} xl={6}>
|
||||
<MiniTrend
|
||||
title="查询量"
|
||||
values={trendRows.map((row) => row.queryTotal)}
|
||||
dates={trendRows.map((row) => row.date)}
|
||||
color="#1677ff"
|
||||
/>
|
||||
</Col>
|
||||
<Col xs={24} md={12} xl={6}>
|
||||
<MiniTrend
|
||||
title="登录量"
|
||||
values={trendRows.map((row) => row.loginTotal)}
|
||||
dates={trendRows.map((row) => row.date)}
|
||||
color="#13c2c2"
|
||||
/>
|
||||
</Col>
|
||||
<Col xs={24} md={12} xl={6}>
|
||||
<MiniTrend
|
||||
title="CK 失效"
|
||||
values={trendRows.map((row) => row.ckInvalid)}
|
||||
dates={trendRows.map((row) => row.date)}
|
||||
color="#ff4d4f"
|
||||
/>
|
||||
</Col>
|
||||
<Col xs={24} md={12} xl={6}>
|
||||
<MiniTrend
|
||||
title="重登成功"
|
||||
values={trendRows.map((row) => row.reloginOk)}
|
||||
dates={trendRows.map((row) => row.date)}
|
||||
color="#52c41a"
|
||||
/>
|
||||
</Col>
|
||||
</Row>
|
||||
<Collapse
|
||||
ghost
|
||||
items={[
|
||||
{
|
||||
key: 'trend-detail',
|
||||
label: '查看每日趋势明细',
|
||||
children: (
|
||||
<Table
|
||||
rowKey="date"
|
||||
size="small"
|
||||
columns={trendColumns}
|
||||
dataSource={trendRows}
|
||||
loading={trendsLoading}
|
||||
pagination={false}
|
||||
scroll={{ x: 750 }}
|
||||
/>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</Space>
|
||||
</Card>
|
||||
|
||||
Reference in New Issue
Block a user