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)
|
||||
}
|
||||
|
||||
// 优先查找 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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user