feat: 完善代理池与抢购链路,发布 0.5.0

This commit is contained in:
yml
2026-11-20 00:48:21 +08:00
parent 2f087ac7f1
commit 98b3dc4b16
28 changed files with 1522 additions and 204 deletions
+15 -2
View File
@@ -50,7 +50,11 @@ func (a *App) StopSeckill() types.MessageResult {
// GetSeckillStatus 返回当前抢购运行状态。
func (a *App) GetSeckillStatus() types.SimpleResult {
return types.SimpleResult{Success: a.scheduler.IsRunning()}
scheduler := a.getScheduler()
if scheduler == nil {
return types.SimpleResult{Success: false}
}
return types.SimpleResult{Success: scheduler.IsRunning()}
}
// StartFixedSeckill 启动和平小店固定次数/间隔抢购。
@@ -117,7 +121,16 @@ func (a *App) GetLogs(since int64) types.LogsResult {
// GetTime 返回服务端时间和本地时间。
func (a *App) GetTime() types.TimeResult {
serverTime, err := a.getClient().ServerTime()
cli := a.getClient()
if cli == nil {
now := time.Now()
return types.TimeResult{
ServerTime: now.In(constants.CST).Format("2006-01-02 15:04:05.000"),
LocalTime: now.In(constants.CST).Format("2006-01-02 15:04:05.000"),
Source: "localFallback",
}
}
serverTime, err := cli.ServerTime()
source := "currentTime"
if err != nil {
source = "localFallback"