From 99885c1ddda87c2883a2cae5fe52c85a19cc53d0 Mon Sep 17 00:00:00 2001 From: yml2213 Date: Sat, 27 Jun 2026 16:39:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8A=96=E5=8A=A8=E5=B9=85?= =?UTF-8?q?=E5=BA=A6=E5=92=8C=E6=97=A5=E5=BF=97=E5=8F=8C=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - jitterDuration 抖动从 base/3 降至 base/10,避免过大的随机延迟 - 日志新增斗鱼双时间显示:本地时间后追加 (D斗鱼时间),前端蓝色高亮 - 时间校准后自动同步斗鱼偏移量到日志模块 --- app.go | 5 +++-- frontend/src/components/log/LogPanel.vue | 8 ++++++++ frontend/src/composables/useLogs.ts | 10 ++++++++++ internal/logger/logger.go | 22 +++++++++++++++++++--- internal/seckill/scheduler.go | 4 ++-- 5 files changed, 42 insertions(+), 7 deletions(-) diff --git a/app.go b/app.go index e79ecc9..0b16204 100644 --- a/app.go +++ b/app.go @@ -86,8 +86,9 @@ func (a *App) startup(ctx context.Context) { logger.LogEvent("图片", "warn", "成功图片目录创建失败,图片保存功能可能不可用: %v", err) } - if serverTime, err := a.client.ServerTime(); err == nil { - logger.LogEvent("时间", "success", "服务端时间获取成功: %s", serverTime.In(constants.CST).Format("2006-01-02 15:04:05.000")) + if sample, err := a.client.ServerTimeSample(); err == nil { + logger.SetDouyuOffset(sample.Offset) + logger.LogEvent("时间", "success", "服务端时间获取成功: %s", sample.EstimatedServerNow().In(constants.CST).Format("2006-01-02 15:04:05.000")) } else { logger.LogEvent("时间", "error", "服务端时间获取失败: %v", err) } diff --git a/frontend/src/components/log/LogPanel.vue b/frontend/src/components/log/LogPanel.vue index 081c9c9..2cae78c 100644 --- a/frontend/src/components/log/LogPanel.vue +++ b/frontend/src/components/log/LogPanel.vue @@ -157,6 +157,7 @@ const handleVerify = async () => {