feat: Initialize core application structure with backend configuration, database, API, and a comprehensive frontend UI for account pooling and management.
This commit is contained in:
@@ -322,8 +322,9 @@ func (d *DB) GetOwnerStats() map[string]int {
|
||||
stats := map[string]int{
|
||||
"total": 0,
|
||||
"valid": 0,
|
||||
"registered": 0,
|
||||
"pooled": 0,
|
||||
"processing": 0,
|
||||
"used": 0,
|
||||
"invalid": 0,
|
||||
}
|
||||
|
||||
var count int
|
||||
@@ -333,11 +334,14 @@ func (d *DB) GetOwnerStats() map[string]int {
|
||||
if err := d.db.QueryRow("SELECT COUNT(*) FROM team_owners WHERE status = 'valid'").Scan(&count); err == nil {
|
||||
stats["valid"] = count
|
||||
}
|
||||
if err := d.db.QueryRow("SELECT COUNT(*) FROM team_owners WHERE status = 'registered'").Scan(&count); err == nil {
|
||||
stats["registered"] = count
|
||||
if err := d.db.QueryRow("SELECT COUNT(*) FROM team_owners WHERE status = 'processing'").Scan(&count); err == nil {
|
||||
stats["processing"] = count
|
||||
}
|
||||
if err := d.db.QueryRow("SELECT COUNT(*) FROM team_owners WHERE status = 'pooled'").Scan(&count); err == nil {
|
||||
stats["pooled"] = count
|
||||
if err := d.db.QueryRow("SELECT COUNT(*) FROM team_owners WHERE status = 'used'").Scan(&count); err == nil {
|
||||
stats["used"] = count
|
||||
}
|
||||
if err := d.db.QueryRow("SELECT COUNT(*) FROM team_owners WHERE status = 'invalid'").Scan(&count); err == nil {
|
||||
stats["invalid"] = count
|
||||
}
|
||||
|
||||
return stats
|
||||
@@ -439,6 +443,21 @@ func (d *DB) GetBatchRuns(limit int) ([]BatchRun, error) {
|
||||
return runs, nil
|
||||
}
|
||||
|
||||
// CleanupStuckBatchRuns 清理卡住的 running 状态批次记录
|
||||
func (d *DB) CleanupStuckBatchRuns() (int64, error) {
|
||||
result, err := d.db.Exec(`
|
||||
UPDATE batch_runs
|
||||
SET status = 'completed',
|
||||
finished_at = COALESCE(finished_at, started_at),
|
||||
duration_seconds = 0
|
||||
WHERE status = 'running'
|
||||
`)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return result.RowsAffected()
|
||||
}
|
||||
|
||||
// GetBatchRunStats 获取批次统计
|
||||
func (d *DB) GetBatchRunStats() map[string]interface{} {
|
||||
stats := make(map[string]interface{})
|
||||
|
||||
Reference in New Issue
Block a user