feat: Implement ChatGPT account registration flow and establish core backend API infrastructure with logging utilities.
This commit is contained in:
@@ -80,7 +80,7 @@ func checkAndCleanErrors() {
|
||||
}
|
||||
|
||||
// 执行清理
|
||||
logger.Info("开始定期清理错误账号...", "", "cleaner")
|
||||
logger.Status("定期清理错误账号中...", "", "cleaner")
|
||||
|
||||
errorAccounts, err := fetchAllErrorAccounts()
|
||||
if err != nil {
|
||||
|
||||
@@ -309,7 +309,7 @@ func runBanCheckTask(owners []database.TeamOwner, concurrency int) {
|
||||
lastBanCheckTime = time.Now()
|
||||
}()
|
||||
|
||||
logger.Info(fmt.Sprintf("开始封禁检查: 共 %d 个母号, 并发数: %d", len(owners), concurrency), "", "ban-check")
|
||||
logger.Status(fmt.Sprintf("封禁检查中: 共 %d 个母号, 并发数: %d", len(owners), concurrency), "", "ban-check")
|
||||
|
||||
// 任务队列
|
||||
taskChan := make(chan database.TeamOwner, len(owners))
|
||||
|
||||
@@ -47,7 +47,7 @@ func HandleCleanErrorAccounts(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
logger.Info("开始清理错误账号...", "", "s2a")
|
||||
logger.Status("清理错误账号中...", "", "s2a")
|
||||
|
||||
// Step 1: 获取所有错误账号
|
||||
errorAccounts, err := fetchAllErrorAccounts()
|
||||
@@ -68,7 +68,7 @@ func HandleCleanErrorAccounts(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
logger.Info(fmt.Sprintf("找到 %d 个错误账号,开始删除...", len(errorAccounts)), "", "s2a")
|
||||
logger.Status(fmt.Sprintf("找到 %d 个错误账号,删除中...", len(errorAccounts)), "", "s2a")
|
||||
|
||||
// Step 2: 逐条删除
|
||||
success := 0
|
||||
|
||||
@@ -740,7 +740,7 @@ func processSingleTeam(idx int, req TeamProcessRequest) (result TeamProcessResul
|
||||
memberStartTime := time.Now()
|
||||
memberLogPrefix := fmt.Sprintf("%s [成员 %d]", logPrefix, memberIdx+1)
|
||||
|
||||
logger.Info(fmt.Sprintf("%s 开始入库 | 邮箱: %s", memberLogPrefix, memberChild.Email), memberChild.Email, "team")
|
||||
logger.Status(fmt.Sprintf("%s 入库中... | 邮箱: %s", memberLogPrefix, memberChild.Email), memberChild.Email, "team")
|
||||
|
||||
var s2aSuccess bool
|
||||
var lastError string
|
||||
@@ -852,7 +852,7 @@ func processSingleTeam(idx int, req TeamProcessRequest) (result TeamProcessResul
|
||||
if req.IncludeOwner && teamProcessState.Running {
|
||||
ownerLogPrefix := fmt.Sprintf("%s [母号 ]", logPrefix)
|
||||
ownerStartTime := time.Now()
|
||||
logger.Info(fmt.Sprintf("%s 开始母号入库...", ownerLogPrefix), owner.Email, "team")
|
||||
logger.Status(fmt.Sprintf("%s 母号入库中...", ownerLogPrefix), owner.Email, "team")
|
||||
|
||||
var ownerSuccess bool
|
||||
var lastError string
|
||||
|
||||
@@ -83,9 +83,9 @@ func HandleUploadValidate(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
// 并发验证账号并获取 account_id(只保留 team 账号)
|
||||
logger.Info(fmt.Sprintf("开始验证账号: 共 %d 个,只导入 plan 为 team 的账号", len(owners)), "", "upload")
|
||||
logger.Status(fmt.Sprintf("验证账号中: 共 %d 个,只导入 plan 为 team 的账号", len(owners)), "", "upload")
|
||||
validOwners, teamCount, nonTeamCount, failCount := validateAndFetchAccountIDs(owners, 20)
|
||||
logger.Info(fmt.Sprintf("验证完成: team=%d, 非team=%d, 失败=%d", teamCount, nonTeamCount, failCount), "", "upload")
|
||||
logger.Success(fmt.Sprintf("验证完成: team=%d, 非team=%d, 失败=%d", teamCount, nonTeamCount, failCount), "", "upload")
|
||||
|
||||
if len(validOwners) == 0 {
|
||||
Error(w, http.StatusBadRequest, fmt.Sprintf("没有有效的 team 账号(共 %d 个,非team: %d,失败: %d)", len(owners), nonTeamCount, failCount))
|
||||
@@ -141,7 +141,7 @@ func HandleRefetchAccountIDs(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
logger.Info(fmt.Sprintf("开始重新获取 account_id: 共 %d 个", len(owners)), "", "upload")
|
||||
logger.Status(fmt.Sprintf("重新获取 account_id 中: 共 %d 个", len(owners)), "", "upload")
|
||||
|
||||
// 并发获取 account_id
|
||||
var wg sync.WaitGroup
|
||||
|
||||
Reference in New Issue
Block a user