fix(lint): 修复 golangci-lint 问题(gofmt + staticcheck)
This commit is contained in:
@@ -93,11 +93,11 @@ type UsageProgress struct {
|
|||||||
|
|
||||||
// UsageInfo 账号使用量信息
|
// UsageInfo 账号使用量信息
|
||||||
type UsageInfo struct {
|
type UsageInfo struct {
|
||||||
UpdatedAt *time.Time `json:"updated_at,omitempty"` // 更新时间
|
UpdatedAt *time.Time `json:"updated_at,omitempty"` // 更新时间
|
||||||
FiveHour *UsageProgress `json:"five_hour"` // 5小时窗口
|
FiveHour *UsageProgress `json:"five_hour"` // 5小时窗口
|
||||||
SevenDay *UsageProgress `json:"seven_day,omitempty"` // 7天窗口
|
SevenDay *UsageProgress `json:"seven_day,omitempty"` // 7天窗口
|
||||||
SevenDaySonnet *UsageProgress `json:"seven_day_sonnet,omitempty"` // 7天Sonnet窗口
|
SevenDaySonnet *UsageProgress `json:"seven_day_sonnet,omitempty"` // 7天Sonnet窗口
|
||||||
GeminiProDaily *UsageProgress `json:"gemini_pro_daily,omitempty"` // Gemini Pro 日配额
|
GeminiProDaily *UsageProgress `json:"gemini_pro_daily,omitempty"` // Gemini Pro 日配额
|
||||||
GeminiFlashDaily *UsageProgress `json:"gemini_flash_daily,omitempty"` // Gemini Flash 日配额
|
GeminiFlashDaily *UsageProgress `json:"gemini_flash_daily,omitempty"` // Gemini Flash 日配额
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,10 +124,10 @@ type ClaudeUsageFetcher interface {
|
|||||||
|
|
||||||
// AccountUsageService 账号使用量查询服务
|
// AccountUsageService 账号使用量查询服务
|
||||||
type AccountUsageService struct {
|
type AccountUsageService struct {
|
||||||
accountRepo AccountRepository
|
accountRepo AccountRepository
|
||||||
usageLogRepo UsageLogRepository
|
usageLogRepo UsageLogRepository
|
||||||
usageFetcher ClaudeUsageFetcher
|
usageFetcher ClaudeUsageFetcher
|
||||||
geminiQuotaService *GeminiQuotaService
|
geminiQuotaService *GeminiQuotaService
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewAccountUsageService 创建AccountUsageService实例
|
// NewAccountUsageService 创建AccountUsageService实例
|
||||||
|
|||||||
@@ -1919,12 +1919,12 @@ func (s *GeminiMessagesCompatService) handleGeminiUpstreamError(ctx context.Cont
|
|||||||
var ra time.Time
|
var ra time.Time
|
||||||
if isCodeAssist {
|
if isCodeAssist {
|
||||||
// Code Assist: fallback cooldown by tier
|
// Code Assist: fallback cooldown by tier
|
||||||
cooldown := geminiCooldownForTier(tierID)
|
cooldown := geminiCooldownForTier(tierID)
|
||||||
if s.rateLimitService != nil {
|
if s.rateLimitService != nil {
|
||||||
cooldown = s.rateLimitService.GeminiCooldown(ctx, account)
|
cooldown = s.rateLimitService.GeminiCooldown(ctx, account)
|
||||||
}
|
}
|
||||||
ra = time.Now().Add(cooldown)
|
ra = time.Now().Add(cooldown)
|
||||||
log.Printf("[Gemini 429] Account %d (Code Assist, tier=%s, project=%s) rate limited, cooldown=%v", account.ID, tierID, projectID, ra.Sub(time.Now()).Truncate(time.Second))
|
log.Printf("[Gemini 429] Account %d (Code Assist, tier=%s, project=%s) rate limited, cooldown=%v", account.ID, tierID, projectID, time.Until(ra).Truncate(time.Second))
|
||||||
} else {
|
} else {
|
||||||
// API Key / AI Studio OAuth: PST 午夜
|
// API Key / AI Studio OAuth: PST 午夜
|
||||||
if ts := nextGeminiDailyResetUnix(); ts != nil {
|
if ts := nextGeminiDailyResetUnix(); ts != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user