feat(admin-web): prefer runtime account health when ranking and gating accounts
Surface the new runtime_health/runtime_checked_at fields through a tiny desktop-account-runtime helper so PublishArticleModal, MediaView, and TrackingView fall back to the desktop client's last live signal instead of the slower DB column. This keeps the publishable card and tracking breakdown in sync with the desktop probe loop. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@ import { computed, ref } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
|
||||
import { mediaApi, resolveApiURL, tenantAccountsApi } from "@/lib/api";
|
||||
import { resolveAccountCheckedAt, resolveAccountHealth } from "@/lib/desktop-account-runtime";
|
||||
import { formatDateTime } from "@/lib/display";
|
||||
import { getPublishPlatformMeta, isPublishPlatformId, normalizePublishPlatformId } from "@/lib/publish-platforms";
|
||||
|
||||
@@ -85,6 +86,7 @@ const mediaAccounts = computed<MediaAccountCard[]>(() => {
|
||||
const platform = platformMap.value.get(platformId);
|
||||
const fallback = getPublishPlatformMeta(platformId);
|
||||
const publishState = resolvePublishState(account);
|
||||
const health = resolveAccountHealth(account);
|
||||
|
||||
return {
|
||||
id: account.id,
|
||||
@@ -96,8 +98,8 @@ const mediaAccounts = computed<MediaAccountCard[]>(() => {
|
||||
displayName: account.display_name,
|
||||
platformUid: normalizePlatformUid(account.platform_uid),
|
||||
avatarUrl: resolveApiURL(account.avatar_url),
|
||||
health: account.health,
|
||||
verifiedAt: account.verified_at,
|
||||
health,
|
||||
verifiedAt: resolveAccountCheckedAt(account),
|
||||
clientId: account.client_id,
|
||||
clientOnline: account.client_online,
|
||||
clientDeviceName: account.client_device_name,
|
||||
@@ -149,7 +151,7 @@ const filteredAccounts = computed(() => {
|
||||
});
|
||||
|
||||
function resolvePublishState(account: DesktopAccountInfo): PublishState {
|
||||
if (account.health !== "live") {
|
||||
if (resolveAccountHealth(account) !== "live") {
|
||||
return "unavailable";
|
||||
}
|
||||
if (!account.client_id) {
|
||||
@@ -165,7 +167,7 @@ function resolvePublishHint(account: DesktopAccountInfo, publishState: PublishSt
|
||||
if (publishState === "queued") {
|
||||
return "客户端当前离线,任务会先进入发布队列,等桌面端上线后自动继续。";
|
||||
}
|
||||
if (account.health !== "live") {
|
||||
if (resolveAccountHealth(account) !== "live") {
|
||||
return "授权状态异常,先在桌面端重新校验后再发布。";
|
||||
}
|
||||
return "还没有绑定桌面客户端,当前无法加入发布队列。";
|
||||
|
||||
Reference in New Issue
Block a user