From 031220d7e767f65c4a6743c174c24bc8134adfa0 Mon Sep 17 00:00:00 2001 From: yml2213 Date: Fri, 26 Jun 2026 11:21:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=91=E6=8D=A2=E5=A4=8D=E9=AA=8C=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=97=B6=E9=97=B4=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.go | 46 ++++++++++++++++++++++++ frontend/src/components/log/LogPanel.vue | 26 ++++++++++++++ frontend/src/composables/useAccounts.ts | 21 +++++------ frontend/src/env.d.ts | 1 + 4 files changed, 81 insertions(+), 13 deletions(-) diff --git a/app.go b/app.go index 9a0d62a..ec7df9d 100644 --- a/app.go +++ b/app.go @@ -240,6 +240,52 @@ func (a *App) VerifyExchange(accountName string) map[string]any { } } +// VerifyAllExchange 批量查询兑换记录,带间隔避免请求过快。 +func (a *App) VerifyAllExchange() map[string]any { + accounts := a.scheduler.AccountSnapshot() + results := make(map[string]any) + + for i, account := range accounts { + if i > 0 { + // 每个请求间隔 200ms,避免太快 + time.Sleep(200 * time.Millisecond) + } + + if account.Cookie == "" { + results[account.Name] = map[string]any{ + "success": false, + "error": "Cookie 为空", + } + continue + } + + records, err := a.client.ExchangeList(account.Cookie) + if err != nil { + results[account.Name] = map[string]any{ + "success": false, + "error": "查询失败: " + err.Error(), + } + continue + } + + // 过滤当前活动的记录 + var matched []client.ExchangeRecord + for _, r := range records { + if r.CommodityID != "" { + matched = append(matched, r) + } + } + + results[account.Name] = map[string]any{ + "success": true, + "records": matched, + "count": len(matched), + } + } + + return results +} + // GetVersion 返回应用版本号。 func (a *App) GetVersion() string { return constants.Version diff --git a/frontend/src/components/log/LogPanel.vue b/frontend/src/components/log/LogPanel.vue index da3beca..e5f861a 100644 --- a/frontend/src/components/log/LogPanel.vue +++ b/frontend/src/components/log/LogPanel.vue @@ -67,6 +67,22 @@ const verifyStats = computed(() => { return { verified, noRecord, failed, total: entries.length } }) +// 格式化时间戳 +const formatTime = (timestamp: string) => { + if (!timestamp) return '' + const ts = parseInt(timestamp) + if (isNaN(ts)) return timestamp + // 斗鱼返回的是秒级时间戳 + const date = new Date(ts * 1000) + return date.toLocaleString('zh-CN', { + month: '2-digit', + day: '2-digit', + hour: '2-digit', + minute: '2-digit', + second: '2-digit' + }) +} + // 执行复验 const handleVerify = async () => { showToast('复验开始', '正在查询斗鱼兑换记录...', 'info') @@ -203,6 +219,7 @@ const handleVerify = async () => {