兑换复验增加时间展示

This commit is contained in:
yml2213
2026-06-26 11:21:11 +08:00
parent 7cb62c0078
commit 031220d7e7
4 changed files with 81 additions and 13 deletions
+46
View File
@@ -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