优化抢购流程日志和复验性能

This commit is contained in:
yml2213
2026-06-27 08:07:21 +08:00
parent c244cc0833
commit c90f80045e
10 changed files with 446 additions and 180 deletions
+11 -8
View File
@@ -7,14 +7,14 @@ import (
// Config 应用配置。
type Config struct {
TimeAPIURL string `json:"timeApiUrl"`
TraceEnabled bool `json:"traceEnabled"`
TraceMaxBody int `json:"traceMaxBody"`
LogLevel string `json:"logLevel"` // debug / info / warn / error
Concurrency int `json:"concurrency"` // 抢购并发数
Attempts int `json:"attempts"` // 单号重试次数
RetryStages []RetryStage `json:"retryStages"` // 重试间隔阶段配置
SeckillMode SeckillMode `json:"seckillMode"` // 抢购模式:0=标准, 1=激进
TimeAPIURL string `json:"timeApiUrl"`
TraceEnabled bool `json:"traceEnabled"`
TraceMaxBody int `json:"traceMaxBody"`
LogLevel string `json:"logLevel"` // debug / info / warn / error
Concurrency int `json:"concurrency"` // 抢购并发数
Attempts int `json:"attempts"` // 单号重试次数
RetryStages []RetryStage `json:"retryStages"` // 重试间隔阶段配置
SeckillMode SeckillMode `json:"seckillMode"` // 抢购模式:0=标准, 1=激进
}
// RetryStage 重试间隔阶段配置。
@@ -106,6 +106,7 @@ type LogEntry struct {
Time string `json:"time"`
Level string `json:"level"`
Category string `json:"category"`
Account string `json:"account,omitempty"`
Message string `json:"message"`
}
@@ -175,6 +176,7 @@ func (c TimeCalibration) IsZero() bool {
type WarmupData struct {
CSRF string
RoleName string
Qualified bool
CreatedAt time.Time
}
@@ -182,5 +184,6 @@ type WarmupData struct {
type AttemptCache struct {
CSRF string
RoleName string
Qualified bool
LastCheck time.Time
}