refactor(accounts): 移除「授权状态」概念——账号收敛为启用/暂停单一状态机
douyin-release-gate / verify (push) Failing after 3m43s
douyin-release-gate / verify (push) Failing after 3m43s
产品已收敛为自有账号管理,撤销授权在 UI 无入口、状态恒为 authorized,属废弃语义: - migration 1045:social_account DROP authorization_status/revoked_at/authorization_kind - 删除 revoke API 路由与 RevokeAccount/disableAccount 状态机分支(PauseAccount 独立) - accountRunnable/就绪判定/采集过滤/登录校验删除 authorization_status 检查 - EnvironmentContext/AccountProfile 契约删字段;前端删「已授权/已撤销」展示与 readiness 分支 - 测试同步:revoke 流程/409 用例删除,seed 语句去列;dev 库测试遗留 revoked 账号待 UI 删除
This commit is contained in:
@@ -19,7 +19,6 @@ interface Row {
|
||||
platform_account_key: string;
|
||||
tags?: string[];
|
||||
runtime_status?: string;
|
||||
authorization_status?: string;
|
||||
work_count?: number;
|
||||
latest_published_at?: string | null;
|
||||
follower_count?: number | null;
|
||||
@@ -127,7 +126,7 @@ export default function AccountManagementList() {
|
||||
}
|
||||
}
|
||||
|
||||
// 扫码后核验:成功视为已登录,刷新列表拿到最新 authorization_status。
|
||||
// 扫码后核验:成功视为已登录,刷新列表同步最新账号状态。
|
||||
async function verifyLogin() {
|
||||
if (!loginTarget) return;
|
||||
setLoginBusy(true);
|
||||
@@ -212,12 +211,9 @@ export default function AccountManagementList() {
|
||||
title: '状态',
|
||||
dataIndex: 'status',
|
||||
render: (_, account) => (
|
||||
<Flex>
|
||||
<Tag color={account.runtime_status === 'active' ? 'success' : 'default'}>
|
||||
{account.runtime_status === 'active' ? '启用' : '暂停'}
|
||||
</Tag>
|
||||
<Typography.Text type="secondary">{account.authorization_status === 'authorized' ? '已授权' : '已撤销'}</Typography.Text>
|
||||
</Flex>
|
||||
<Tag color={account.runtime_status === 'active' ? 'success' : 'default'}>
|
||||
{account.runtime_status === 'active' ? '启用' : '暂停'}
|
||||
</Tag>
|
||||
) },
|
||||
{
|
||||
title: '操作',
|
||||
|
||||
@@ -209,7 +209,6 @@ export default function Page() {
|
||||
<Card title="账号状态" extra={pauseResume}>
|
||||
<Flex vertical gap={16}>
|
||||
<Descriptions column={1} size="small">
|
||||
<Descriptions.Item label="授权">{account.authorization_status === 'authorized' ? '已授权' : '已撤销'}</Descriptions.Item>
|
||||
<Descriptions.Item label="运行">{`${account.runtime_status === 'active' ? '启用' : '暂停'} · 版本 ${account.version}`}</Descriptions.Item>
|
||||
<Descriptions.Item label="标签">{account.tags?.join('、') || '无'}</Descriptions.Item>
|
||||
<Descriptions.Item label="作品采集">
|
||||
|
||||
@@ -58,9 +58,8 @@ export function extractShareURL(value?: string): string {
|
||||
return candidates?.find((candidate) => platformForShareURL(candidate)) || candidates?.[0] || '';
|
||||
}
|
||||
|
||||
// 账号可恢复性判定(对齐归档版 accountReadiness):授权、绑定、出口健康、账号暂停四层。
|
||||
// 账号可恢复性判定(对齐归档版 accountReadiness):绑定、出口健康、账号暂停三层。
|
||||
export const readinessReasonText: Record<string, string> = {
|
||||
account_revoked: '授权已撤销',
|
||||
account_paused: '账号已暂停',
|
||||
binding_missing: '未绑定运行环境',
|
||||
network_exit_missing: '未绑定固定出口',
|
||||
@@ -80,8 +79,6 @@ export interface AccountReadiness {
|
||||
}
|
||||
|
||||
export function accountReadiness(account: any, binding: any, bindingError: any = null): AccountReadiness {
|
||||
if (account.authorization_status !== 'authorized')
|
||||
return { label: '授权已撤销', reason: 'account_revoked', canResume: false, ready: false };
|
||||
if (bindingError) return { label: '环境状态未知', reason: 'environment_unavailable', canResume: false, ready: false };
|
||||
if (!binding) return { label: '未绑定运行环境', reason: 'binding_missing', canResume: false, ready: false };
|
||||
let blocked = '';
|
||||
@@ -105,9 +102,5 @@ export function accountReadiness(account: any, binding: any, bindingError: any =
|
||||
}
|
||||
|
||||
export function isCollectionAccount(account: any): boolean {
|
||||
return (
|
||||
account.authorization_status === 'authorized' &&
|
||||
['normal', 'muted'].includes(account.business_status) &&
|
||||
account.login_status === 'logged_in'
|
||||
);
|
||||
return ['normal', 'muted'].includes(account.business_status) && account.login_status === 'logged_in';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user