feat: Add API endpoints for uploading and managing team owner accounts, including flexible content parsing and concurrent account ID fetching.

This commit is contained in:
2026-01-30 13:27:22 +08:00
parent 23901c9d14
commit 402daf79ad

View File

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