This commit is contained in:
oneao committed 2026-01-13 22:18:01 +08:00
1 parent 6277fb2f9e
commit 8ecac0d7dd
270 files changed
+40438 -529

No files matched your search

@@ -0,0 +1,27 @@
package middleware
import (
"allapp/db"
"allapp/logx"
"context"
"github.com/cloudwego/hertz/pkg/app"
)
func RefreshActive() app.HandlerFunc {
return func(c context.Context, ctx *app.RequestContext) {
// 先执行后续 handler
ctx.Next(c)
userID := GetUserID(c)
if userID == 0 {
return
}
// 异步刷新活跃时间
go func() {
if err := db.Queries.UpdateUserActiveTime(c, userID); err != nil {
logx.CtxError(c, "刷新用户活跃时间失败, userID=%d, err=%v", userID, err)
}
}()
}
}