fix: Rock Token 超时按满 2/3 天判定并统一显示口径
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user