feat: implement backend routing, dashboard components, and transaction reconciliation scripts
This commit is contained in:
@@ -1501,8 +1501,13 @@ export function AccountCenter() {
|
||||
? expiryFormatted
|
||||
: displayExpiryRaw || copy.proPendingSync
|
||||
: copy.noProSubscription;
|
||||
const showExpiringSoon =
|
||||
Boolean(isSubscribed && expiryInfo && !expiryInfo.expired && expiryInfo.daysLeft <= 3);
|
||||
const showExpiringSoon = Boolean(
|
||||
isSubscribed &&
|
||||
!hasQueuedExtension &&
|
||||
expiryInfo &&
|
||||
!expiryInfo.expired &&
|
||||
expiryInfo.daysLeft <= 3,
|
||||
);
|
||||
const showExpiredReminder = Boolean(!isSubscribed && expiryInfo && expiryInfo.expired);
|
||||
const paymentFeatureReady = paymentReadyForRecovery;
|
||||
const canOpenCheckoutOverlay = Boolean(
|
||||
|
||||
@@ -47,12 +47,17 @@ export function HeaderBar() {
|
||||
store.proAccess.subscriptionExpiresAt
|
||||
: store.proAccess.subscriptionExpiresAt;
|
||||
const expiryInfo = parseExpiryInfo(effectiveExpiry);
|
||||
const hasQueuedExtension = Boolean(
|
||||
store.proAccess.subscriptionActive &&
|
||||
store.proAccess.subscriptionQueuedDays > 0,
|
||||
);
|
||||
const isTrialPlan = /trial/i.test(
|
||||
String(store.proAccess.subscriptionPlanCode || ""),
|
||||
);
|
||||
const showRenewReminder =
|
||||
isAuthenticated &&
|
||||
!store.proAccess.loading &&
|
||||
!hasQueuedExtension &&
|
||||
((store.proAccess.subscriptionActive &&
|
||||
expiryInfo &&
|
||||
expiryInfo.daysLeft <= 3) ||
|
||||
|
||||
@@ -286,7 +286,11 @@ type MembershipEntry = {
|
||||
registered_at?: string | null;
|
||||
plan_code?: string | null;
|
||||
starts_at?: string | null;
|
||||
current_expires_at?: string | null;
|
||||
total_expires_at?: string | null;
|
||||
expires_at?: string | null;
|
||||
queued_days?: number | null;
|
||||
queued_count?: number | null;
|
||||
};
|
||||
|
||||
function formatDateTime(value?: string | null) {
|
||||
@@ -301,6 +305,15 @@ function formatUnixDateTime(value?: number | null) {
|
||||
return formatDateTime(new Date(value * 1000).toISOString());
|
||||
}
|
||||
|
||||
function formatMembershipExpiry(item: MembershipEntry) {
|
||||
const total = item.total_expires_at || item.expires_at;
|
||||
const current = item.current_expires_at || item.expires_at;
|
||||
const queuedDays = Math.max(0, Number(item.queued_days || 0));
|
||||
const totalLabel = formatDateTime(total);
|
||||
if (!queuedDays || !current || current === total) return totalLabel;
|
||||
return `${totalLabel}(已续 +${queuedDays} 天)`;
|
||||
}
|
||||
|
||||
function formatMetric(value?: number | null, digits = 3) {
|
||||
if (value === null || value === undefined || Number.isNaN(value)) return "-";
|
||||
return Number(value).toFixed(digits);
|
||||
@@ -1535,7 +1548,7 @@ export function OpsDashboard() {
|
||||
<div className="mt-3 grid gap-2">
|
||||
<MobileField label="User ID" value={item.user_id || "-"} mono />
|
||||
<MobileField label="注册时间" value={formatDateTime(item.registered_at)} />
|
||||
<MobileField label="到期时间" value={formatDateTime(item.expires_at)} />
|
||||
<MobileField label="到期时间" value={formatMembershipExpiry(item)} />
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
@@ -1563,7 +1576,7 @@ export function OpsDashboard() {
|
||||
<td className="px-4 py-3">{item.username || "-"}</td>
|
||||
<td className="px-4 py-3 font-mono text-xs text-slate-300">{item.user_id || "-"}</td>
|
||||
<td className="px-4 py-3">{formatDateTime(item.registered_at)}</td>
|
||||
<td className="px-4 py-3">{formatDateTime(item.expires_at)}</td>
|
||||
<td className="px-4 py-3">{formatMembershipExpiry(item)}</td>
|
||||
</tr>
|
||||
))}
|
||||
{!memberships.length ? (
|
||||
|
||||
Reference in New Issue
Block a user