sync: soul-admin 页面 | 原因: 前端页面修改
This commit is contained in:
@@ -72,39 +72,6 @@ export function CKBStatsTab({ onSwitchTab }: Props = {}) {
|
||||
|
||||
useEffect(() => { loadStats() }, [loadStats])
|
||||
|
||||
const typeMap = ['partner', 'investor', 'mentor', 'team']
|
||||
const getTestBody = (idx: number) => {
|
||||
const phone = testPhone.trim(); const wechat = testWechat.trim()
|
||||
if (idx <= 3) return { type: typeMap[idx], phone: phone || undefined, wechat: wechat || undefined, userId: 'admin_test', name: '后台测试' }
|
||||
if (idx === 4) return { matchType: 'partner', phone: phone || undefined, wechat: wechat || undefined, userId: 'admin_test', nickname: '后台测试', matchedUser: { id: 'test', nickname: '测试', matchScore: 88 } }
|
||||
if (idx === 5) return { phone: phone || undefined, wechatId: wechat || undefined, userId: 'admin_test', name: '后台测试' }
|
||||
return {}
|
||||
}
|
||||
|
||||
const testEndpoint = async (idx: number) => {
|
||||
const test = ckbTests[idx]
|
||||
if (test.method === 'POST' && !testPhone.trim() && !testWechat.trim()) { alert('请填写测试手机号'); return }
|
||||
const updated = [...ckbTests]; updated[idx] = { ...test, status: 'testing', message: undefined, responseTime: undefined }; setCkbTests(updated)
|
||||
const start = performance.now()
|
||||
try {
|
||||
const res = test.method === 'GET'
|
||||
? await get<{ success?: boolean; message?: string }>(test.endpoint)
|
||||
: await post<{ success?: boolean; message?: string }>(test.endpoint, getTestBody(idx))
|
||||
const elapsed = Math.round(performance.now() - start)
|
||||
const msg = res?.message || ''
|
||||
const ok = res?.success === true || msg.includes('已存在') || msg.includes('已加入')
|
||||
const next = [...ckbTests]; next[idx] = { ...test, status: ok ? 'success' : 'error', message: msg || (ok ? '正常' : '异常'), responseTime: elapsed }; setCkbTests(next)
|
||||
} catch (e: unknown) {
|
||||
const elapsed = Math.round(performance.now() - start)
|
||||
const next = [...ckbTests]; next[idx] = { ...test, status: 'error', message: e instanceof Error ? e.message : '请求失败', responseTime: elapsed }; setCkbTests(next)
|
||||
}
|
||||
}
|
||||
|
||||
const testAll = async () => {
|
||||
if (!testPhone.trim() && !testWechat.trim()) { alert('请填写测试手机号'); return }
|
||||
for (let i = 0; i < ckbTests.length; i++) await testEndpoint(i)
|
||||
}
|
||||
|
||||
const v = (n: number | undefined) => isLoading ? '—' : String(n ?? 0)
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user