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:
@@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user