优化(账号自动化): 履约保护登录配额与重登优先级
This commit is contained in:
@@ -1774,11 +1774,35 @@ export interface AutomationJobUpdate {
|
||||
concurrency?: number;
|
||||
}
|
||||
|
||||
export interface AutomationLoginQuotaCategoryUsage {
|
||||
priority: string;
|
||||
category: string;
|
||||
label: string;
|
||||
limit: number;
|
||||
used: number;
|
||||
remaining: number;
|
||||
pending: number;
|
||||
}
|
||||
|
||||
export interface AutomationLoginQuotaUsageSummary {
|
||||
quota_day: string;
|
||||
quota_hour: number;
|
||||
daily_limit: number;
|
||||
daily_used: number;
|
||||
daily_remaining: number;
|
||||
hourly_limit: number;
|
||||
hourly_used: number;
|
||||
hourly_remaining: number;
|
||||
categories: AutomationLoginQuotaCategoryUsage[];
|
||||
}
|
||||
|
||||
export interface AutomationLoginQuota {
|
||||
daily_attempt_limit: number;
|
||||
hourly_attempt_limit: number;
|
||||
per_account_daily_limit: number;
|
||||
onboarding_daily_limit: number;
|
||||
relogin_protected_daily_limit: number;
|
||||
lease_refresh_daily_limit: number;
|
||||
relogin_high_value_daily_limit: number;
|
||||
relogin_ordinary_daily_limit: number;
|
||||
manual_daily_limit: number;
|
||||
@@ -1786,6 +1810,7 @@ export interface AutomationLoginQuota {
|
||||
failure_pause_ratio: number;
|
||||
enabled: boolean;
|
||||
updated_at?: string | null;
|
||||
usage?: AutomationLoginQuotaUsageSummary;
|
||||
}
|
||||
|
||||
export interface AutomationLoginQuotaRecommendation {
|
||||
@@ -1798,6 +1823,8 @@ export interface AutomationLoginQuotaRecommendation {
|
||||
invalid_backlog: number;
|
||||
invalid_high_value: number;
|
||||
invalid_ordinary: number;
|
||||
protected_valid_accounts: number;
|
||||
protected_invalid_backlog: number;
|
||||
imported_backlog: number;
|
||||
recent_sample: number;
|
||||
recent_success_rate: number;
|
||||
|
||||
@@ -55,9 +55,11 @@ const BUDGET_LABELS: Record<string, string> = {
|
||||
daily_attempt_limit: "全局每日尝试",
|
||||
hourly_attempt_limit: "全局每小时尝试",
|
||||
per_account_daily_limit: "单账号每日尝试",
|
||||
onboarding_daily_limit: "首次登录",
|
||||
relogin_high_value_daily_limit: "高价值账号重登",
|
||||
relogin_ordinary_daily_limit: "普通账号重登",
|
||||
relogin_protected_daily_limit: "P0 履约保护失效重登",
|
||||
lease_refresh_daily_limit: "P1 履约快过期续期",
|
||||
relogin_high_value_daily_limit: "P2 高价值账号重登",
|
||||
relogin_ordinary_daily_limit: "P3 普通账号重登",
|
||||
onboarding_daily_limit: "P4 首次登录",
|
||||
manual_daily_limit: "人工登录保留",
|
||||
login_concurrency: "登录并发",
|
||||
failure_pause_ratio: "失败率熔断",
|
||||
@@ -67,9 +69,11 @@ type BudgetFieldName =
|
||||
| "daily_attempt_limit"
|
||||
| "hourly_attempt_limit"
|
||||
| "per_account_daily_limit"
|
||||
| "onboarding_daily_limit"
|
||||
| "relogin_protected_daily_limit"
|
||||
| "lease_refresh_daily_limit"
|
||||
| "relogin_high_value_daily_limit"
|
||||
| "relogin_ordinary_daily_limit"
|
||||
| "onboarding_daily_limit"
|
||||
| "manual_daily_limit"
|
||||
| "login_concurrency"
|
||||
| "failure_pause_ratio";
|
||||
@@ -84,9 +88,31 @@ const BUDGET_FIELDS: Array<{
|
||||
{ name: "daily_attempt_limit", label: "全局每日尝试", min: 1, max: 1_000_000 },
|
||||
{ name: "hourly_attempt_limit", label: "全局每小时尝试", min: 1, max: 100_000 },
|
||||
{ name: "per_account_daily_limit", label: "单账号每日尝试", min: 1, max: 100 },
|
||||
{ name: "onboarding_daily_limit", label: "首次登录预算", min: 0, max: 100_000 },
|
||||
{ name: "relogin_high_value_daily_limit", label: "高价值重登预算", min: 0, max: 100_000 },
|
||||
{ name: "relogin_ordinary_daily_limit", label: "普通重登预算", min: 0, max: 100_000 },
|
||||
{
|
||||
name: "relogin_protected_daily_limit",
|
||||
label: "P0 履约保护失效重登预算",
|
||||
min: 0,
|
||||
max: 100_000,
|
||||
},
|
||||
{
|
||||
name: "lease_refresh_daily_limit",
|
||||
label: "P1 履约快过期续期预算",
|
||||
min: 0,
|
||||
max: 100_000,
|
||||
},
|
||||
{
|
||||
name: "relogin_high_value_daily_limit",
|
||||
label: "P2 高价值重登预算",
|
||||
min: 0,
|
||||
max: 100_000,
|
||||
},
|
||||
{
|
||||
name: "relogin_ordinary_daily_limit",
|
||||
label: "P3 普通重登预算",
|
||||
min: 0,
|
||||
max: 100_000,
|
||||
},
|
||||
{ name: "onboarding_daily_limit", label: "P4 首次登录预算", min: 0, max: 100_000 },
|
||||
{ name: "manual_daily_limit", label: "人工登录保留", min: 0, max: 100_000 },
|
||||
{ name: "login_concurrency", label: "登录并发", min: 1, max: 10 },
|
||||
{ name: "failure_pause_ratio", label: "失败率熔断阈值", min: 0, max: 100, suffix: "%" },
|
||||
@@ -119,7 +145,7 @@ const JOB_UI: Record<string, JobUiSpec> = {
|
||||
showConcurrency: false,
|
||||
},
|
||||
lease_ck_refresh: {
|
||||
description: "对仍有效、但预测 24 小时内到期的生效租约账号提前登录续 CK;只处理 platform_fulfillment / douyu_collab 租约。",
|
||||
description: "对仍有效、但预测 24 小时内到期的履约保护账号提前登录续 CK;覆盖预售、协作单和生效租约。",
|
||||
core: true,
|
||||
showRecheck: false,
|
||||
showConcurrency: true,
|
||||
@@ -654,6 +680,78 @@ export default function AutomationPage() {
|
||||
|
||||
const budgetTab = (
|
||||
<Space orientation="vertical" size={16} style={{ width: "100%" }}>
|
||||
{loginQuota?.usage ? (
|
||||
<Card
|
||||
title="今日优先级配额消耗与积压"
|
||||
extra={
|
||||
<Space size={16}>
|
||||
<Text type="secondary">
|
||||
今日全局 {loginQuota.usage.daily_used} / {loginQuota.usage.daily_limit}
|
||||
</Text>
|
||||
<Text type="secondary">
|
||||
本小时 {loginQuota.usage.hourly_used} / {loginQuota.usage.hourly_limit}
|
||||
</Text>
|
||||
</Space>
|
||||
}
|
||||
>
|
||||
<Alert
|
||||
type="info"
|
||||
showIcon
|
||||
style={{ marginBottom: 12 }}
|
||||
message="严格按 P0 > P1 > P2 > P3 > P4 顺序预留与调度"
|
||||
description="当剩余小时/日配额紧张时,低优先级类别会自动为高优先级类别让路;其中 P0/P1 涵盖预售、协作单和生效租约全部履约保护目标。"
|
||||
/>
|
||||
<Table
|
||||
rowKey="category"
|
||||
size="small"
|
||||
pagination={false}
|
||||
dataSource={loginQuota.usage.categories}
|
||||
columns={[
|
||||
{
|
||||
title: "优先级",
|
||||
dataIndex: "priority",
|
||||
width: 85,
|
||||
render: (value: string) => (
|
||||
<Tag
|
||||
color={
|
||||
value === "P0"
|
||||
? "red"
|
||||
: value === "P1"
|
||||
? "orange"
|
||||
: value === "P2"
|
||||
? "gold"
|
||||
: value === "人工"
|
||||
? "green"
|
||||
: "default"
|
||||
}
|
||||
>
|
||||
{value}
|
||||
</Tag>
|
||||
),
|
||||
},
|
||||
{ title: "类别", dataIndex: "label" },
|
||||
{
|
||||
title: "待处理积压",
|
||||
dataIndex: "pending",
|
||||
width: 110,
|
||||
render: (value: number, row) =>
|
||||
row.category === "manual_login" ? "-" : value,
|
||||
},
|
||||
{ title: "今日已用", dataIndex: "used", width: 100 },
|
||||
{ title: "每日上限", dataIndex: "limit", width: 100 },
|
||||
{
|
||||
title: "今日剩余",
|
||||
dataIndex: "remaining",
|
||||
width: 100,
|
||||
render: (value: number) => (
|
||||
<Text type={value > 0 ? "success" : "danger"}>{value}</Text>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</Card>
|
||||
) : null}
|
||||
|
||||
<Card
|
||||
title="登录预算与并发"
|
||||
extra={
|
||||
|
||||
@@ -52,9 +52,10 @@ const LOGIN_CATEGORY_LABELS: Record<string, string> = {
|
||||
onboarding: '首次登录',
|
||||
relogin_high_value: '高价值重登',
|
||||
relogin_ordinary: '普通重登',
|
||||
relogin_protected: '履约保护重登',
|
||||
manual: '人工登录',
|
||||
account_check: '账号检测',
|
||||
lease_refresh: '租约CK续期',
|
||||
lease_refresh: '履约快过期续期',
|
||||
};
|
||||
|
||||
function loginSourceLabel(task: LoginTaskItem) {
|
||||
|
||||
Reference in New Issue
Block a user