"use client"; import { useEffect, useState } from "react"; import { RefreshCcw, CheckCircle2 } from "lucide-react"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { opsApi } from "@/lib/ops-api"; import type { PaymentRuntimePayload, PaymentIncident } from "@/types/ops"; export function PaymentsPageClient() { const [loading, setLoading] = useState(true); const [runtime, setRuntime] = useState(null); const [incidents, setIncidents] = useState([]); const [resolving, setResolving] = useState>(new Set()); const load = async () => { setLoading(true); try { const [rt, inc] = await Promise.all([ opsApi.paymentRuntime() as Promise, opsApi.incidents(50), ]); setRuntime(rt); setIncidents((inc as unknown as { incidents?: PaymentIncident[] }).incidents ?? []); } catch { /* */ } setLoading(false); }; const handleResolve = async (id: number) => { setResolving((prev) => new Set(prev).add(id)); try { await opsApi.resolveIncident(id); setIncidents((prev) => prev.filter((i) => i.id !== id)); } catch { /* */ } setResolving((prev) => { const next = new Set(prev); next.delete(id); return next; }); }; useEffect(() => { void load(); }, []); if (loading) return
加载中...
; return (

支付管理

支付运行时
{runtime ? Object.entries({ chain_id: runtime.chain_id, last_scanned_block: runtime.last_scanned_block, audit_events_count: runtime.audit_events_count, }).map(([k, v]) => (
{k}
{String(v ?? "—")}
)) : 无数据}
{runtime?.receiver_contract ? (
receiver_contract
{runtime.receiver_contract}
) : null}
支付异常 ({incidents.length}) {incidents.length === 0 ? ( 暂无异常 ) : (
{incidents.map((inc) => ( ))}
ID 原因 时间 操作
{inc.id} {inc.reason ?? "—"} {inc.created_at?.slice(0, 19) ?? "—"}
)}
); }