fix(widget): 优化访客在线续接与历史地区回填
CI / Backend (go vet + test) (push) Failing after 9m33s
CI / Frontend (typecheck + lint + build) (push) Successful in 11m57s

This commit is contained in:
yml2213
2026-11-06 18:51:44 +08:00
parent de1ffbf4f6
commit 93ef9f2040
6 changed files with 178 additions and 10 deletions
+11
View File
@@ -13,6 +13,7 @@ import (
"kefu-cloud/server/internal/metrics"
"kefu-cloud/server/internal/middleware"
"kefu-cloud/server/internal/model"
"kefu-cloud/server/internal/service"
"kefu-cloud/server/internal/storage"
"kefu-cloud/server/internal/ws"
)
@@ -29,6 +30,16 @@ func main() {
} else if geoip.Enabled() {
log.Printf("GeoIP 数据库已启用: %s", cfg.GeoIP.DBPath)
defer geoip.Close()
go func() {
updated, err := service.BackfillVisitorGeoIP(context.Background())
if err != nil {
log.Printf("警告: 历史访客地区回填失败: %v", err)
return
}
if updated > 0 {
log.Printf("历史访客地区回填完成: %d 条", updated)
}
}()
}
// 初始化 JWT(有效期可用 JWT_EXPIRE_HOURS 配置,默认 24 小时)