diff --git a/backend/internal/api/upload.go b/backend/internal/api/upload.go index 68fae63..569f7dd 100644 --- a/backend/internal/api/upload.go +++ b/backend/internal/api/upload.go @@ -382,20 +382,21 @@ func fetchAccountID(token string) (string, error) { return "", fmt.Errorf("解析响应失败: %v", err) } - // 优先查找 plan_type 包含 "team" 的账户 - for key, acc := range result.Accounts { - if key == "default" { + // 优先查找 plan_type 为 "team" 的账户 + // 注意:account_id 是 map 的 key,而不是 Account.ID 字段 + for accountID, info := range result.Accounts { + if accountID == "default" { continue } - if strings.Contains(strings.ToLower(acc.Account.PlanType), "team") { - return acc.Account.ID, nil + if strings.Contains(strings.ToLower(info.Account.PlanType), "team") { + return accountID, nil } } - // 否则取第一个非 "default" 的账户 ID - for key, acc := range result.Accounts { - if key != "default" && acc.Account.ID != "" { - return acc.Account.ID, nil + // 否则取第一个非 "default" 的账户 + for accountID := range result.Accounts { + if accountID != "default" { + return accountID, nil } }