fix: validate signatures and restore report metrics

This commit is contained in:
hectorzhao
2026-07-27 20:51:14 +08:00
parent 04a497c791
commit 94aeacd3a2
19 changed files with 438 additions and 42 deletions
+2 -1
View File
@@ -1,6 +1,7 @@
import { useState, type ReactNode } from 'react';
import { AlertTriangle, ShieldCheck, Trash2 } from 'lucide-react';
import { adminApi, clientApi, type DeletionPreflight, type DeletionResult, type DeletionTargetType } from '@/api/adminApi';
import { createUuid } from '@/utils/randomId';
import { Button } from './Button';
import { Modal } from './Modal';
import { Textarea } from './Textarea';
@@ -24,7 +25,7 @@ export function DeleteRiskAction({ portal, targetType, targetId, children = '删
const [idempotencyKey, setIdempotencyKey] = useState('');
async function begin() {
const key = `delete:${targetType}:${targetId}:${crypto.randomUUID()}`;
const key = `delete:${targetType}:${targetId}:${createUuid()}`;
setOpen(true); setLoading(true); setPreflight(null); setResult(null); setReason(''); setError(''); setIdempotencyKey(key);
try {
const data = portal === 'admin'
+2 -1
View File
@@ -1,6 +1,7 @@
import { useEffect, useState } from 'react';
import { adminApi, type ManualRechargePreflight, type ManualRechargeResult } from '@/api/adminApi';
import { formatCents, isValidMoneyInput, yuanToMoneyUnits } from '@/utils/currency';
import { createUuid } from '@/utils/randomId';
import { Button } from './Button';
import { Input } from './Input';
import { Modal } from './Modal';
@@ -73,7 +74,7 @@ export function ManualRechargeDialog({ initialTargetId, lockTarget = false, onCl
try {
const preview = await adminApi.preflightManualRecharge({ tenantId, amountCents: yuanToMoneyUnits(amount) });
setReview(preview);
setIdempotencyKey(`manual-recharge:${crypto.randomUUID()}`);
setIdempotencyKey(`manual-recharge:${createUuid()}`);
} catch (failure) {
setError(failure instanceof Error ? failure.message : '人工充值资格核对失败');
} finally {
+2 -1
View File
@@ -1,6 +1,7 @@
import { useState, type ReactNode } from 'react';
import { AlertTriangle, Check, ShieldCheck } from 'lucide-react';
import { adminApi, type ReviewDecisionResult, type ReviewPreflight } from '@/api/adminApi';
import { createUuid } from '@/utils/randomId';
import { Button } from './Button';
import { Modal } from './Modal';
@@ -28,7 +29,7 @@ export function RiskAction({
const [idempotencyKey, setIdempotencyKey] = useState('');
async function begin() {
const key = `review:${targetType}:${targetId}:${crypto.randomUUID()}`;
const key = `review:${targetType}:${targetId}:${createUuid()}`;
setOpen(true);
setLoading(true);
setResult(null);