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)
}
// 优先查找 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
}
}