feat: 新增激进抢购模式
- 添加 SeckillMode 类型(标准/激进) - 激进模式:第一轮完整校验,后续复用 CSRF 直接兑换 - 每轮开始时清空缓存,强制重新获取 CSRF - 设置面板添加模式切换 - 缓存 30 秒有效期,CSRF 错误时自动回退标准模式
This commit is contained in:
@@ -14,6 +14,7 @@ type Config struct {
|
||||
Concurrency int `json:"concurrency"` // 抢购并发数
|
||||
Attempts int `json:"attempts"` // 单号重试次数
|
||||
RetryStages []RetryStage `json:"retryStages"` // 重试间隔阶段配置
|
||||
SeckillMode SeckillMode `json:"seckillMode"` // 抢购模式:0=标准, 1=激进
|
||||
}
|
||||
|
||||
// RetryStage 重试间隔阶段配置。
|
||||
@@ -22,6 +23,14 @@ type RetryStage struct {
|
||||
Interval int `json:"interval"` // 重试间隔(ms)
|
||||
}
|
||||
|
||||
// SeckillMode 抢购模式。
|
||||
type SeckillMode int
|
||||
|
||||
const (
|
||||
SeckillModeNormal SeckillMode = iota // 标准模式:每次完整校验
|
||||
SeckillModeAggressive // 激进模式:复用校验结果
|
||||
)
|
||||
|
||||
// AppPaths 运行时路径。
|
||||
type AppPaths struct {
|
||||
ConfigFile string
|
||||
@@ -168,3 +177,10 @@ type WarmupData struct {
|
||||
RoleName string
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
// AttemptCache 单个账号的兑换缓存(激进模式使用)。
|
||||
type AttemptCache struct {
|
||||
CSRF string
|
||||
RoleName string
|
||||
LastCheck time.Time
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user