feat: Add team process API.
This commit is contained in:
@@ -486,10 +486,43 @@ func processSingleTeam(idx int, req TeamProcessRequest) (result TeamProcessResul
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Step 0: 预检查账户状态(封禁/Token过期检测)
|
||||||
|
resolvedProxy := database.Instance.ResolveProxy(req.Proxy)
|
||||||
|
preChecker := invite.NewWithProxy(owner.Token, resolvedProxy)
|
||||||
|
accountStatus := preChecker.CheckAccountStatus()
|
||||||
|
|
||||||
|
if accountStatus.Status == "banned" {
|
||||||
|
logger.Error(fmt.Sprintf("%s 母号被封禁,跳过处理: %s", logPrefix, accountStatus.Error), owner.Email, "team")
|
||||||
|
if database.Instance != nil {
|
||||||
|
database.Instance.MarkOwnerAsInvalid(owner.Email)
|
||||||
|
database.Instance.DeleteTeamOwnerByEmail(owner.Email)
|
||||||
|
logger.Info(fmt.Sprintf("%s 封禁母号已删除: %s", logPrefix, owner.Email), owner.Email, "team")
|
||||||
|
}
|
||||||
|
result.Errors = append(result.Errors, "账户被封禁")
|
||||||
|
result.DurationMs = time.Since(startTime).Milliseconds()
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
if accountStatus.Status == "token_expired" {
|
||||||
|
logger.Error(fmt.Sprintf("%s Token已过期,跳过处理", logPrefix), owner.Email, "team")
|
||||||
|
if database.Instance != nil {
|
||||||
|
database.Instance.MarkOwnerAsInvalid(owner.Email)
|
||||||
|
database.Instance.DeleteTeamOwnerByEmail(owner.Email)
|
||||||
|
logger.Info(fmt.Sprintf("%s Token过期母号已删除: %s", logPrefix, owner.Email), owner.Email, "team")
|
||||||
|
}
|
||||||
|
result.Errors = append(result.Errors, "Token已过期")
|
||||||
|
result.DurationMs = time.Since(startTime).Milliseconds()
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
if accountStatus.Status == "error" {
|
||||||
|
logger.Warning(fmt.Sprintf("%s 账户状态检查失败: %s,继续尝试", logPrefix, accountStatus.Error), owner.Email, "team")
|
||||||
|
} else {
|
||||||
|
logger.Info(fmt.Sprintf("%s 账户状态正常: %s", logPrefix, accountStatus.PlanType), owner.Email, "team")
|
||||||
|
}
|
||||||
|
|
||||||
// Step 1: 获取 Team ID(优先使用已存储的 account_id)
|
// Step 1: 获取 Team ID(优先使用已存储的 account_id)
|
||||||
var teamID string
|
var teamID string
|
||||||
// Resolve proxy for inviter
|
|
||||||
resolvedProxy := database.Instance.ResolveProxy(req.Proxy)
|
|
||||||
inviter := invite.NewWithProxy(owner.Token, resolvedProxy)
|
inviter := invite.NewWithProxy(owner.Token, resolvedProxy)
|
||||||
|
|
||||||
if owner.AccountID != "" {
|
if owner.AccountID != "" {
|
||||||
|
|||||||
Reference in New Issue
Block a user