fix: Rock Token 超时按满 2/3 天判定并统一显示口径

This commit is contained in:
2026-11-10 17:25:59 +08:00
parent 162745082b
commit 227d4b93ad
9 changed files with 190 additions and 23 deletions
+9
View File
@@ -4,6 +4,7 @@ import (
"context"
"errors"
"strings"
"time"
"affiliate_dash/internal/model"
)
@@ -27,6 +28,13 @@ func (s *RockService) ListSupportBoundTokens(ctx context.Context, page, pageSize
pageSize = 100
}
cfg, err := s.GetConfig(ctx)
if err != nil {
return nil, 0, err
}
warnDays, dangerDays, boundWarnDays := rockOverdueThresholds(cfg)
now := time.Now()
db := s.db.WithContext(ctx).Model(&model.RockToken{}).Where("status = ?", model.RockStatusBound)
term := "%" + search + "%"
db = db.Where(
@@ -45,6 +53,7 @@ func (s *RockService) ListSupportBoundTokens(ctx context.Context, page, pageSize
Find(&tokens).Error; err != nil {
return nil, 0, err
}
applyRockTokenOverdueFlags(tokens, now, warnDays, dangerDays, boundWarnDays)
s.prepareRockTokenList(ctx, tokens)
return tokens, total, nil
}